Fix problem in addingredientform, change filter for container in QrcodeForm

This commit is contained in:
quark 2024-08-27 10:45:53 +02:00
parent 549f56dc0b
commit 213e9a8b12
1 changed files with 5 additions and 2 deletions

View File

@ -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