1. gmcguire
  2. django-registration


ubernostrum  committed 18898ef

Correcting use of get() in RegistrationForm

  • Participants
  • Parent commits 4fa9875
  • Branches default

Comments (0)

Files changed (1)

File forms.py

View file
  • Ignore whitespace
         Validates that the username is not already in use.
-        if self.clean_data.get('username'):
+        if self.clean_data.get('username', None):
                 user = User.objects.get(username__exact=self.clean_data['username'])
             except User.DoesNotExist:
         Validates that the two password inputs match.
-        if self.clean_data.get('password1') and self.clean_data.get('password2') and \
+        if self.clean_data.get('password1', None) and self.clean_data.get('password2', None) and \
            self.clean_data['password1'] == self.clean_data['password2']:
             return self.clean_data['password2']
         raise forms.ValidationError(u'You must type the same password each time')