Restructure cookbook directories and use Grappelli for the admin interface.
[cookbook.git] / cookbook / models.py
index cfad7b588687259b968cc7ad87530502b5fdb41a..f32eb9e2432dd77b51615c4e6921996c8f5ad47a 100644 (file)
@@ -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}'