From a8a7fdbe2a10560d8cd18717eaa780efb2cc3149 Mon Sep 17 00:00:00 2001 From: Tom Teichler <tom.teichler@teckids.org> Date: Sun, 20 Mar 2022 18:58:22 +0100 Subject: [PATCH] Use payment choices from InvoiceGroup --- aleksis/apps/paweljong/forms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/paweljong/forms.py b/aleksis/apps/paweljong/forms.py index c71b5cb..82b3d63 100644 --- a/aleksis/apps/paweljong/forms.py +++ b/aleksis/apps/paweljong/forms.py @@ -8,7 +8,7 @@ from django_select2.forms import ModelSelect2MultipleWidget, ModelSelect2Widget from material import Fieldset, Layout, Row from phonenumber_field.formfields import PhoneNumberField -from aleksis.apps.tezor.models.invoice import Invoice +from aleksis.apps.tezor.models.invoice import InvoiceGroup from aleksis.core.mixins import ExtensibleForm from aleksis.core.models import Group, Person @@ -339,7 +339,6 @@ class RegisterEventFinancial(ExtensibleForm): ) payment_method = forms.ChoiceField( - choices=Invoice.get_variant_choices(), label=_("Payment method"), help_text=_( "Please choose a payment method. " @@ -347,6 +346,12 @@ class RegisterEventFinancial(ExtensibleForm): ), ) + def __init__(self, *args, **kwargs): + super().__init__(self, *args, **kwargs) + + self.fields["payment_method"].choices = InvoiceGroup.objects.get(name="Hack'n'Fun-Veranstaltungen").get_variant_choices() + + class Meta: model = EventRegistration fields = ["voucher_code", "donation"] -- GitLab