mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 07:08:03 -05:00
Update serializer.py
image location should use MEDIA_URL alone and not combine with SCRIPT_NAME
This commit is contained in:
@@ -22,7 +22,7 @@ from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, Fo
|
|||||||
SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile,
|
SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile,
|
||||||
UserPreference, ViewLog)
|
UserPreference, ViewLog)
|
||||||
from cookbook.templatetags.custom_tags import markdown
|
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):
|
class ExtendedRecipeMixin(serializers.ModelSerializer):
|
||||||
@@ -56,7 +56,7 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
|
|||||||
|
|
||||||
def get_image(self, obj):
|
def get_image(self, obj):
|
||||||
if obj.recipe_image:
|
if obj.recipe_image:
|
||||||
return SCRIPT_NAME + MEDIA_URL + obj.recipe_image
|
return MEDIA_URL + obj.recipe_image
|
||||||
|
|
||||||
def count_recipes(self, obj):
|
def count_recipes(self, obj):
|
||||||
return Recipe.objects.filter(**{self.recipe_filter: obj}, space=obj.space).count()
|
return Recipe.objects.filter(**{self.recipe_filter: obj}, space=obj.space).count()
|
||||||
|
|||||||
Reference in New Issue
Block a user