forked from DGNum/gestioCOF
change resell and reinit forms
This commit is contained in:
parent
f5b23174de
commit
d9402e1059
3 changed files with 68 additions and 85 deletions
16
bda/forms.py
16
bda/forms.py
|
@ -45,6 +45,7 @@ class AttributionModelMultipleChoiceField(forms.ModelMultipleChoiceField):
|
|||
|
||||
class ResellForm(forms.Form):
|
||||
attributions = AttributionModelMultipleChoiceField(
|
||||
label='',
|
||||
queryset=Attribution.objects.none(),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False)
|
||||
|
@ -58,6 +59,7 @@ class ResellForm(forms.Form):
|
|||
|
||||
class AnnulForm(forms.Form):
|
||||
attributions = AttributionModelMultipleChoiceField(
|
||||
label='',
|
||||
queryset=Attribution.objects.none(),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False)
|
||||
|
@ -81,3 +83,17 @@ class InscriptionReventeForm(forms.Form):
|
|||
super(InscriptionReventeForm, self).__init__(*args, **kwargs)
|
||||
self.fields['spectacles'].queryset = tirage.spectacle_set.filter(
|
||||
date__gte=timezone.now())
|
||||
|
||||
|
||||
class SoldForm(forms.Form):
|
||||
attributions = AttributionModelMultipleChoiceField(
|
||||
label='',
|
||||
queryset=Attribution.objects.none(),
|
||||
widget=forms.CheckboxSelectMultiple)
|
||||
|
||||
def __init__(self, participant, *args, **kwargs):
|
||||
super(SoldForm, self).__init__(*args, **kwargs)
|
||||
self.fields['attributions'].queryset = participant.attribution_set\
|
||||
.filter(revente__isnull=False,
|
||||
revente__soldTo__isnull=False)\
|
||||
.exclude(revente__soldTo=participant)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue