diff --git a/club/forms.py b/club/forms.py index 4f5d9b85..865d66a0 100644 --- a/club/forms.py +++ b/club/forms.py @@ -157,7 +157,7 @@ class MailingForm(forms.Form): return cleaned_data -class SellingsFormBase(forms.Form): +class SellingsForm(forms.Form): begin_date = forms.DateTimeField( input_formats=["%Y-%m-%d %H:%M:%S"], label=_("Begin date"), @@ -174,6 +174,20 @@ class SellingsFormBase(forms.Form): Counter.objects.order_by("name").all(), label=_("Counter"), required=False ) + def __init__(self, club, *args, **kwargs): + + super(SellingsForm, self).__init__(*args, **kwargs) + self.fields["product"] = forms.ModelChoiceField( + club.products.order_by("name").filter(archived=False).all(), + label=_("Product"), + required=False, + ) + self.fields["archived_product"] = forms.ModelChoiceField( + club.products.order_by("name").filter(archived=True).all(), + label=_("Archived product"), + required=False, + ) + class ClubMemberForm(forms.Form): """ diff --git a/club/templates/club/club_sellings.jinja b/club/templates/club/club_sellings.jinja index c5da0e61..56065ac1 100644 --- a/club/templates/club/club_sellings.jinja +++ b/club/templates/club/club_sellings.jinja @@ -3,7 +3,7 @@ {% block content %}