fix apis
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user