File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 22from django .contrib .auth .models import User
33from django .contrib .auth .forms import UserCreationForm
44from django .core .exceptions import ValidationError
5+ from .models import Profile
56
67
78class UserLoginForm (forms .Form ):
@@ -12,6 +13,7 @@ class UserLoginForm(forms.Form):
1213
1314class UserRegistrationForm (UserCreationForm ):
1415 """Form to register new user"""
16+ email = forms .EmailField (max_length = 75 , required = True )
1517 password1 = forms .CharField (
1618 label = "Password" , widget = forms .PasswordInput )
1719 password2 = forms .CharField (
@@ -20,7 +22,10 @@ class UserRegistrationForm(UserCreationForm):
2022
2123 class Meta :
2224 model = User
23- fields = ['email' , 'username' , 'password1' , 'password2' ]
25+ help_texts = {
26+ 'username' : None
27+ }
28+ fields = ['username' , 'email' , 'password1' , 'password2' ]
2429
2530 def clean_email (self ):
2631 email = self .cleaned_data .get ('email' )
@@ -40,3 +45,9 @@ def clean_password2(self):
4045 raise ValidationError ("Passwords must match." )
4146
4247 return password2
48+
49+
50+ class EditProfileForm (forms .ModelForm ):
51+ class Meta :
52+ model = Profile
53+ fields = ('image' ,)
You can’t perform that action at this time.
0 commit comments