Commit ddc60dd8 authored by Jim Driessen's avatar Jim Driessen

Prevent setting automatic member payment fees to true without an IBAN.

parent 8a5cc220
......@@ -31,6 +31,7 @@ class ProfileInline(admin.StackedInline):
'emergency_contact_phone_number', 'language',
'event_permissions')
model = models.Profile
form = forms.MemberForm
can_delete = False
......
......@@ -23,6 +23,14 @@ class ProfileForm(forms.ModelForm):
'receive_optin', 'receive_newsletter']
model = Profile
def clean(self):
direct_debit_authorized = self.cleaned_data\
.get('direct_debit_authorized')
bank_account = self.cleaned_data.get('bank_account')
if direct_debit_authorized and len(bank_account) < 16:
raise forms.ValidationError(_('Bank account is incorrect'))
super().clean()
class UserCreationForm(BaseUserCreationForm):
# Don't forget to edit the formset in admin.py!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment