club fixes.
[wolnelektury.git] / src / club / forms.py
index f919855..675c18d 100644 (file)
@@ -3,7 +3,7 @@
 #
 from decimal import Decimal
 from django import forms
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
 from newsletter.forms import NewsletterForm
 from . import models, payment_methods
 from .payu.forms import CardTokenForm
@@ -135,7 +135,11 @@ class DonationStep1Form(forms.ModelForm):
             'monthly'
             ]
 
-        
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        club = models.Club.objects.first()
+        self.fields['custom_amount'].widget.attrs['min'] = club.min_amount
+
     def clean(self):
         state = {}
         state['monthly'] = self.cleaned_data['switch'] == 'monthly'
@@ -143,7 +147,7 @@ class DonationStep1Form(forms.ModelForm):
         state['amount'] = \
             self.cleaned_data[f'{which}_amount'] or \
             self.cleaned_data['custom_amount'] or \
-            self.cleaned_data[f'{monthly}_amount_selected']
+            self.cleaned_data[f'{which}_amount_selected']
 
         return state