From 1228d3dbc6d9656012881db2fa7bb8f381879b7f Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 25 Sep 2018 02:18:31 +0200 Subject: [PATCH] Add product_name to GenericPaymentForm --- hosting/forms.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hosting/forms.py b/hosting/forms.py index 2deb04dc..aae50ac5 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _ from membership.models import CustomUser from utils.hosting_utils import get_all_public_keys -from .models import UserHostingKey +from .models import UserHostingKey, GenericProduct logger = logging.getLogger(__name__) @@ -53,22 +53,29 @@ class HostingUserLoginForm(forms.Form): class GenericPaymentForm(forms.Form): + product_name = forms.ModelChoiceField( + queryset=GenericProduct.objects.all().order_by('product_name'), + empty_label=_("Choose a product"), + to_field_name='product_name' + ) amount = forms.FloatField( widget=forms.TextInput( attrs={'placeholder': _('Amount in CHF')} ), max_value=999999, - min_value=1 + min_value=1, + disabled=True ) recurring = forms.BooleanField(required=False, - label=_("Recurring monthly")) + label=_("Recurring monthly"), + disabled=True) description = forms.CharField( - widget=forms.Textarea(attrs={'style': "height: 150px;"}), + widget=forms.Textarea(attrs={'style': "height: 100px;"}), required=False ) class Meta: - fields = ['amount', 'recurring', 'description'] + fields = ['product_name', 'amount', 'recurring', 'description'] class HostingUserSignupForm(forms.ModelForm):