From 2149f4034bf518687c600ec73889e89efb69b8bd Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 17 Mar 2021 23:28:28 +0100 Subject: [PATCH] several shopping list improvements --- cookbook/models.py | 6 +++--- cookbook/templates/shopping_list.html | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cookbook/models.py b/cookbook/models.py index c99cb691..2e9237c9 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -510,14 +510,14 @@ class ShoppingListRecipe(models.Model, PermissionModelMixin): recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, null=True, blank=True) servings = models.DecimalField(default=1, max_digits=8, decimal_places=4) - objects = ScopedManager(space='shoppinglist__space') + objects = ScopedManager(space='recipe__space') @staticmethod def get_space_key(): - return 'shoppinglist', 'space' + return 'recipe', 'space' def get_space(self): - return self.shoppinglist_set.first().space + return self.recipe.space def __str__(self): return f'Shopping list recipe {self.id} - {self.recipe}' diff --git a/cookbook/templates/shopping_list.html b/cookbook/templates/shopping_list.html index c52414d0..c366a2db 100644 --- a/cookbook/templates/shopping_list.html +++ b/cookbook/templates/shopping_list.html @@ -122,8 +122,8 @@ - + @change="dragChanged(c, $event)" handle=".handle"> + [[element.amount]] [[element.unit.name]] @@ -154,7 +154,7 @@
-
@@ -349,6 +349,8 @@ +
+
@@ -448,7 +450,7 @@ name: gettext('Uncategorized'), id: -1, entries: [], - order: 99999999 + order: -1 } }