ContactForm: Prevent TypeError during validation

This commit is contained in:
Raphael Michel
2017-09-25 09:38:35 +02:00
parent 9f0deea9dd
commit ef3eee7873

View File

@@ -49,7 +49,7 @@ class ContactForm(forms.Form):
self.fields[key] = value
def clean(self):
if self.event.settings.order_email_asked_twice:
if self.event.settings.order_email_asked_twice and self.cleaned_data.get('email') and self.cleaned_data.get('email_repeat'):
if self.cleaned_data.get('email').lower() != self.cleaned_data.get('email_repeat').lower():
raise ValidationError(_('Please enter the same email address twice.'))