Anonymous committed 18898ef

Correcting use of get() in RegistrationForm

Comments (0)

Files changed (1)

         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')