mirror of
https://github.com/nanoy42/coope
synced 2024-12-23 23:43:47 +00:00
Fix du formulaire de fût
Seuls les bons types de produits sont proposés dans les champs pinte, demi et galopin. Close #16
This commit is contained in:
parent
63363c9219
commit
bac0a46ca2
1 changed files with 6 additions and 0 deletions
|
@ -32,6 +32,12 @@ class ProductForm(forms.ModelForm):
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
class KegForm(forms.ModelForm):
|
class KegForm(forms.ModelForm):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(KegForm, self).__init__(*args, **kwargs)
|
||||||
|
self.fields['pinte'].queryset = Product.objects.filter(category=Product.P_PRESSION)
|
||||||
|
self.fields['demi'].queryset = Product.objects.filter(category=Product.D_PRESSION)
|
||||||
|
self.fields['galopin'].queryset = Product.objects.filter(category=Product.G_PRESSION)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Keg
|
model = Keg
|
||||||
exclude = ("is_active", )
|
exclude = ("is_active", )
|
||||||
|
|
Loading…
Reference in a new issue