This commit is contained in:
smilerz
2021-10-28 12:05:29 -05:00
parent 7c6a7ef6a4
commit 27f358dd03
3 changed files with 3 additions and 3 deletions

View File

@ -826,7 +826,7 @@ class ShoppingListRecipe(ExportModelOperationsMixin('shopping_list_recipe'), mod
def get_owner(self):
try:
return self.entries.first().created_by or self.shoppinglist_set.first().created_by
return getattr(self.entries.first(), 'created_by', None) or getattr(self.shoppinglist_set.first(), 'created_by', None)
except AttributeError:
return None

View File

@ -357,7 +357,7 @@ class FoodSerializer(UniqueFieldsMixin, WritableNestedModelSerializer, ExtendedR
supermarket_category = SupermarketCategorySerializer(allow_null=True, required=False)
recipe = RecipeSimpleSerializer(allow_null=True, required=False)
shopping = serializers.SerializerMethodField('get_shopping_status')
ignore_inherit = FoodInheritFieldSerializer(many=True)
ignore_inherit = FoodInheritFieldSerializer(many=True, allow_null=True, required=False)
recipe_filter = 'steps__ingredients__food'

View File

@ -43,7 +43,7 @@ def space_2():
def get_random_recipe(space_1, u1_s1):
r = Recipe.objects.create(
name=uuid.uuid4(),
name=str(uuid.uuid4()),
waiting_time=20,
working_time=20,
servings=4,