moved generic multiselect create function into component

This commit is contained in:
vabene1111
2022-04-14 14:08:16 +02:00
parent 7befa4a084
commit 3159868ba4
7 changed files with 43 additions and 41 deletions

View File

@ -600,11 +600,11 @@ class IngredientViewSet(viewsets.ModelViewSet):
def get_queryset(self):
queryset = self.queryset.filter(step__recipe__space=self.request.space)
food = self.request.query_params.get('food', None)
if food and re.match(r'^([1-9])+$', food):
if food and re.match(r'^(\d)+$', food):
queryset = queryset.filter(food_id=food)
unit = self.request.query_params.get('unit', None)
if unit and re.match(r'^([1-9])+$', unit):
if unit and re.match(r'^(\d)+$', unit):
queryset = queryset.filter(unit_id=unit)
return queryset