- def clean_amount(self):
- value = self.cleaned_data['amount']
- club = models.Club.objects.first()
- if club and value < club.min_amount:
- raise forms.ValidationError(
- _('Minimal amount is %(amount)d PLN.') % {
- 'amount': club.min_amount
- }
- )
- return value
-
- def clean_method(self):
- value = self.cleaned_data['method']
- monthly = self.cleaned_data['monthly']
- for m in payment_methods.methods:
- if m.slug == value:
- if (monthly and m.is_recurring) or (not monthly and m.is_onetime):
- return value
- if monthly:
- return payment_methods.recurring_payment_method.slug
- else:
- return payment_methods.single_payment_method.slug
-