diff --git a/registration/forms.py b/registration/forms.py index 79e893c3..320b4ac4 100644 --- a/registration/forms.py +++ b/registration/forms.py @@ -9,6 +9,9 @@ class RegistrationForm(forms.Form): email_again = forms.CharField(max_length=254, required=True, label="Email Again") def clean(self): + if ' ' in self.cleaned_data['username']: + raise forms.ValidationError(u'Username can not contain a space') + if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data: if self.cleaned_data['password'] != self.cleaned_data['password_again']: raise forms.ValidationError(u'Passwords do not match')