X-Git-Url: http://git.tremily.us/?p=cookbook.git;a=blobdiff_plain;f=cookbook%2Fmodels.py;fp=cookbook%2Fmodels.py;h=f32eb9e2432dd77b51615c4e6921996c8f5ad47a;hp=cfad7b588687259b968cc7ad87530502b5fdb41a;hb=54ef55b5be084b7039fcc40ef4d09f2ff7424aac;hpb=bfc63a763ae32e0bf25c7087a85fb329ab3f1630 diff --git a/cookbook/models.py b/cookbook/models.py index cfad7b5..f32eb9e 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -129,9 +129,10 @@ class Recipe (Amount, Directions): class IngredientBlock (Directions): name = models.CharField(max_length=200) recipe = models.ForeignKey(Recipe) + position = models.PositiveIntegerField() class Meta: - ordering = ['recipe', 'name'] + ordering = ['recipe', 'position'] def __unicode__(self): return u'{0.name}'.format(self) @@ -142,6 +143,10 @@ class Ingredient (Amount): name = models.CharField(max_length=200) note = models.CharField(max_length=200, null=True, blank=True) block = models.ForeignKey(IngredientBlock) + position = models.PositiveIntegerField() + + class Meta: + ordering = ['block', 'position'] def __unicode__(self): fmt = '{i.name}'