Remove disabled on amount/recurring fields
This commit is contained in:
parent
10e8f0a820
commit
48ba6a6166
1 changed files with 10 additions and 5 deletions
|
@ -52,29 +52,34 @@ class HostingUserLoginForm(forms.Form):
|
||||||
raise forms.ValidationError(_("User does not exist"))
|
raise forms.ValidationError(_("User does not exist"))
|
||||||
|
|
||||||
|
|
||||||
|
class ProductModelChoiceField(forms.ModelChoiceField):
|
||||||
|
def label_from_instance(self, obj):
|
||||||
|
return obj.product_name
|
||||||
|
|
||||||
|
|
||||||
class GenericPaymentForm(forms.Form):
|
class GenericPaymentForm(forms.Form):
|
||||||
product_name = forms.ModelChoiceField(
|
product_name = ProductModelChoiceField(
|
||||||
queryset=GenericProduct.objects.all().order_by('product_name'),
|
queryset=GenericProduct.objects.all().order_by('product_name'),
|
||||||
empty_label=_("Choose a product"),
|
empty_label=_("Choose a product"),
|
||||||
to_field_name='product_name'
|
|
||||||
)
|
)
|
||||||
amount = forms.FloatField(
|
amount = forms.FloatField(
|
||||||
widget=forms.TextInput(
|
widget=forms.TextInput(
|
||||||
attrs={'placeholder': _('Amount in CHF')}
|
attrs={'placeholder': _('Amount in CHF'),
|
||||||
|
'readonly': 'readonly'}
|
||||||
),
|
),
|
||||||
max_value=999999,
|
max_value=999999,
|
||||||
min_value=1,
|
min_value=1,
|
||||||
disabled=True
|
|
||||||
)
|
)
|
||||||
recurring = forms.BooleanField(required=False,
|
recurring = forms.BooleanField(required=False,
|
||||||
label=_("Recurring monthly"),
|
label=_("Recurring monthly"),
|
||||||
disabled=True)
|
)
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
widget=forms.Textarea(attrs={'style': "height: 100px;"}),
|
widget=forms.Textarea(attrs={'style': "height: 100px;"}),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
model = GenericProduct
|
||||||
fields = ['product_name', 'amount', 'recurring', 'description']
|
fields = ['product_name', 'amount', 'recurring', 'description']
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue