forked from DGNum/gestioCOF
Prettify revente/manage
This commit is contained in:
parent
010ce0df3e
commit
f66a54bb73
5 changed files with 101 additions and 48 deletions
32
bda/forms.py
32
bda/forms.py
|
@ -103,27 +103,26 @@ class ReventeModelMultipleChoiceField(forms.ModelMultipleChoiceField):
|
|||
|
||||
|
||||
class ResellForm(forms.Form):
|
||||
attributions = AttributionModelMultipleChoiceField(
|
||||
label="",
|
||||
queryset=Attribution.objects.none(),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False,
|
||||
)
|
||||
|
||||
def __init__(self, participant, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["attributions"].queryset = (
|
||||
participant.attribution_set.filter(spectacle__date__gte=timezone.now())
|
||||
self.fields["attributions"] = TemplateLabelField(
|
||||
queryset=participant.attribution_set.filter(
|
||||
spectacle__date__gte=timezone.now()
|
||||
)
|
||||
.exclude(revente__seller=participant)
|
||||
.select_related("spectacle", "spectacle__location", "participant__user")
|
||||
.select_related("spectacle", "spectacle__location", "participant__user"),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False,
|
||||
label_template_name="bda/forms/attribution_label_table.html",
|
||||
option_template_name="bda/forms/checkbox_table.html",
|
||||
context_object_name="attribution",
|
||||
)
|
||||
|
||||
|
||||
class AnnulForm(forms.Form):
|
||||
def __init__(self, participant, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["reventes"] = ReventeModelMultipleChoiceField(
|
||||
own=True,
|
||||
self.fields["reventes"] = TemplateLabelField(
|
||||
label="",
|
||||
queryset=participant.original_shows.filter(
|
||||
attribution__spectacle__date__gte=timezone.now(), soldTo__isnull=True
|
||||
|
@ -134,6 +133,9 @@ class AnnulForm(forms.Form):
|
|||
.order_by("-date"),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False,
|
||||
label_template_name="bda/forms/revente_self_label_table.html",
|
||||
option_template_name="bda/forms/checkbox_table.html",
|
||||
context_object_name="revente",
|
||||
)
|
||||
|
||||
|
||||
|
@ -194,8 +196,7 @@ class ReventeTirageForm(forms.Form):
|
|||
class SoldForm(forms.Form):
|
||||
def __init__(self, participant, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["reventes"] = ReventeModelMultipleChoiceField(
|
||||
own=True,
|
||||
self.fields["reventes"] = TemplateLabelField(
|
||||
label="",
|
||||
queryset=participant.original_shows.filter(soldTo__isnull=False)
|
||||
.exclude(soldTo=participant)
|
||||
|
@ -203,5 +204,8 @@ class SoldForm(forms.Form):
|
|||
"attribution__spectacle", "attribution__spectacle__location"
|
||||
),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
label_template_name="bda/forms/revente_sold_label_table.html",
|
||||
option_template_name="bda/forms/checkbox_table.html",
|
||||
context_object_name="revente",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue