+ fields = [
+ 'amount',
+ 'monthly'
+ ]
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ club = models.Club.objects.first()
+ if club is not None:
+ self.fields['custom_amount'].widget.attrs['min'] = club.min_amount
+
+ def clean(self):
+ state = {}
+ state['monthly'] = self.cleaned_data['switch'] == 'monthly'
+ which = 'monthly' if state['monthly'] else 'single'
+ state['amount'] = \
+ self.cleaned_data[f'{which}_amount'] or \
+ self.cleaned_data['custom_amount'] or \
+ self.cleaned_data[f'{which}_amount_selected']
+
+ return state
+
+
+
+class DonationStep2Form(forms.ModelForm, NewsletterForm):
+ class Meta:
+ model = models.Schedule
+ fields = [
+ 'first_name', 'last_name',
+ 'email', 'phone',
+ 'postal',
+ 'postal_code', 'postal_town', 'postal_country',
+ ]