Skip to content

Commit

Permalink
Merge pull request #58 from laginha/master
Browse files Browse the repository at this point in the history
fix issue #27
  • Loading branch information
macropin committed May 16, 2015
2 parents 998cddf + 88c10f1 commit c73536c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from registration.users import UserModel

User = UserModel()

class RegistrationForm(UserCreationForm):
"""
Expand All @@ -34,8 +35,8 @@ class RegistrationForm(UserCreationForm):
email = forms.EmailField(label=_("E-mail"))

class Meta:
model = UserModel()
fields = ("username", "email")
model = User
fields = (getattr(User, 'USERNAME_FIELD', 'username'), "email")


class RegistrationFormTermsOfService(RegistrationForm):
Expand All @@ -61,7 +62,7 @@ def clean_email(self):
site.
"""
if UserModel().objects.filter(email__iexact=self.cleaned_data['email']):
if User.objects.filter(email__iexact=self.cleaned_data['email']):
raise forms.ValidationError(_("This email address is already in use. Please supply a different email address."))
return self.cleaned_data['email']

Expand Down

0 comments on commit c73536c

Please sign in to comment.