Commit 88541082 authored by Alexandre's avatar Alexandre

bugfix: #109

parent 59dffab1
......@@ -15,10 +15,10 @@ class EmailRegistrationForm(RegistrationForm):
def clean_email(self):
if User.objects.filter(username=self.cleaned_data['email']).exists():
raise ValidationError("Un utilisateur avec cette adresse email existe déjà.")
self.instance.username = self.cleaned_data['email']
return self.cleaned_data['email']
def save(self):
self.instance.username = self.instance.email
user = super().save()
self.instance.userprofile = UserProfile(postcode=self.cleaned_data['postcode'], user=user)
user.userprofile.save()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment