Private
Public Access
1
0

offercoaching form works

This commit is contained in:
Sander Roosendaal
2019-02-20 20:15:44 +01:00
parent ee7a83a76b
commit 1052c61589
3 changed files with 1 additions and 18 deletions

View File

@@ -3201,23 +3201,6 @@ class AccountRowerForm(ModelForm):
if self.instance.rowerplan != 'coach':
self.fields.pop('offercoaching')
def clean_email(self):
email = self.cleaned_data.get('email')
try:
validate_email(email)
except ValidationError:
raise forms.ValidationError(
'Please enter a valid email address')
try:
match = User.objects.get(email__iexact=email)
if self.instance.user == match:
return email
except User.DoesNotExist:
return email
raise forms.ValidationError('This email address is not allowed')

Binary file not shown.

View File

@@ -178,7 +178,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
if request.method == 'POST':
accountform = AccountRowerForm(request.POST)
accountform = AccountRowerForm(request.POST, instance=r)
userform = UserForm(request.POST,instance=r.user)
if accountform.is_valid() and userform.is_valid():