I'm trying to create a small product manufacturing app with Django. There are two main models in the app.
class Product(models.Model):
name = models.CharField(max_length=100, blank=True, default='')
class ProductionOrder(models.Model):
created = models.DateTimeField(auto_now_add=True)
entries = # not sure what goes here
I would like ProductionOrder.entries to be a list of dictionaries which include the Product and a quantity value.
The created ProductionOrder would appear as so (not exactly sure :
productionOrder = {
'id': 2,
'entries': [
{ 'product': 'product_1_ref', 'quantity': 10},
{ 'product': 'product_2_ref', 'quantity': 10}
]
}
How can I accomplish this in a correct way?