offercoaching form works
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user