Commit abb8bc56 authored by Sylvane Suminguit's avatar Sylvane Suminguit

minor edits to fix second iteration

parent 4f6e37f0
......@@ -3,6 +3,8 @@ from django.contrib.auth.forms import UserCreationForm, User
from django.urls import reverse_lazy
from django.views import generic
from django import forms
from django.core.exceptions import ValidationError
class UserCreateForm(UserCreationForm):
email = forms.EmailField(required = True, label ='Email',)
......@@ -17,9 +19,10 @@ class UserCreateForm(UserCreationForm):
if commit:
user.save()
return user
"""
def clean_email(self):
if User.objects.filter(email=self.cleaned_data['email']).exists():
raise ValidationError(self.fields['email'].error_messages['exists'])
return self.cleaned_data['email']
"""
\ No newline at end of file
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