WIP
This commit is contained in:
@ -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
|
||||
|
@ -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,)
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user