1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-11-02 08:34:32 +01:00

Autocomplete food on ManageIngredients now show owners

This commit is contained in:
Ehouarn
2025-10-31 23:26:17 +01:00
parent b9bf01f2e3
commit 78372807f8
5 changed files with 17 additions and 11 deletions

View File

@@ -21,9 +21,13 @@ class FoodSerializer(serializers.ModelSerializer):
REST API Serializer for Food.
The djangorestframework plugin will analyse the model `Food` and parse all fields in the API.
"""
# This fields is used for autocompleting food in ManageIngredientsView
# TODO Find a better way to do it
owner_name = serializers.CharField(source='owner.name', read_only=True)
class Meta:
model = Food
fields = '__all__'
fields = ['name', 'owner', 'allergens', 'expiry_date', 'end_of_life', 'is_ready', 'order', 'owner_name']
class BasicFoodSerializer(serializers.ModelSerializer):