From 213e9a8b1241b1942472d535a227360729b4f75c Mon Sep 17 00:00:00 2001 From: quark Date: Tue, 27 Aug 2024 10:45:53 +0200 Subject: [PATCH] Fix problem in addingredientform, change filter for container in QrcodeForm --- apps/food/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/food/forms.py b/apps/food/forms.py index 0b2532aa..7551a8c5 100644 --- a/apps/food/forms.py +++ b/apps/food/forms.py @@ -22,7 +22,6 @@ class AddIngredientForms(forms.ModelForm): super().__init__(*args, **kwargs) self.fields['ingredient'].queryset = self.fields['ingredient'].queryset.filter( polymorphic_ctype__model='transformedfood', - owner_id=self.instance.owner_id, is_ready=False, is_active=True, was_eaten=False, @@ -70,7 +69,11 @@ class QRCodeForms(forms.ModelForm): """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields['food_container'].queryset = self.fields['food_container'].queryset.filter(is_ready=False) + self.fields['food_container'].queryset = self.fields['food_container'].queryset.filter( + is_active=True, + was_eaten=False, + polymorphic_ctype__model='transformedfood', + ) class Meta: model = QRCode