From e313481fc8b65acf5a6b9368242ebe349e0a702d Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 13 Jan 2022 16:00:59 -0600 Subject: [PATCH] WIP --- cookbook/helper/shopping_helper.py | 1 + cookbook/models.py | 1 + cookbook/serializer.py | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/helper/shopping_helper.py b/cookbook/helper/shopping_helper.py index 658f63caa..c1a3dc1a2 100644 --- a/cookbook/helper/shopping_helper.py +++ b/cookbook/helper/shopping_helper.py @@ -38,6 +38,7 @@ def shopping_helper(qs, request): return qs.order_by(*supermarket_order).select_related('unit', 'food', 'ingredient', 'created_by', 'list_recipe', 'list_recipe__mealplan', 'list_recipe__recipe') +# TODO refactor as class def list_from_recipe(list_recipe=None, recipe=None, mealplan=None, servings=None, ingredients=None, created_by=None, space=None, append=False): """ Creates ShoppingListRecipe and associated ShoppingListEntrys from a recipe or a meal plan with a recipe diff --git a/cookbook/models.py b/cookbook/models.py index 7187db335..7e4bd1f64 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -1146,6 +1146,7 @@ class ModelFilter(models.Model): field = models.CharField(max_length=32) field_type = models.CharField(max_length=32, choices=(FIELD_TYPE)) operation = models.CharField(max_length=32, choices=(OPERATION)) + negate = models.BooleanField(default=False,) target_value = models.CharField(max_length=128) sort = models.BooleanField(default=False,) ascending = models.BooleanField(default=True,) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 09520545f..48236f399 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -22,7 +22,7 @@ from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, Fo SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile, UserPreference, ViewLog) from cookbook.templatetags.custom_tags import markdown -from recipes.settings import MEDIA_URL, SCRIPT_NAME +from recipes.settings import MEDIA_URL class ExtendedRecipeMixin(serializers.ModelSerializer): @@ -56,7 +56,7 @@ class ExtendedRecipeMixin(serializers.ModelSerializer): def get_image(self, obj): if obj.recipe_image: - return SCRIPT_NAME + MEDIA_URL + obj.recipe_image + return MEDIA_URL + obj.recipe_image def count_recipes(self, obj): return Recipe.objects.filter(**{self.recipe_filter: obj}, space=obj.space).count()