ordering of ingredients and steps
This commit is contained in:
@ -150,10 +150,14 @@ class Ingredient(models.Model):
|
||||
unit = models.ForeignKey(Unit, on_delete=models.PROTECT)
|
||||
amount = models.DecimalField(default=0, decimal_places=16, max_digits=32)
|
||||
note = models.CharField(max_length=64, null=True, blank=True)
|
||||
order = models.IntegerField(default=0)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.amount) + ' ' + str(self.unit) + ' ' + str(self.food)
|
||||
|
||||
class Meta:
|
||||
ordering = ['order', 'pk']
|
||||
|
||||
|
||||
class Step(models.Model):
|
||||
TEXT = 'TEXT'
|
||||
@ -161,6 +165,10 @@ class Step(models.Model):
|
||||
kind = models.CharField(choices=((TEXT, _('Text')),), default=TEXT, max_length=16)
|
||||
instruction = models.TextField(blank=True)
|
||||
ingredients = models.ManyToManyField(Ingredient, blank=True)
|
||||
order = models.IntegerField(default=0)
|
||||
|
||||
class Meta:
|
||||
ordering = ['order', 'pk']
|
||||
|
||||
|
||||
class Recipe(models.Model):
|
||||
|
Reference in New Issue
Block a user