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 2
2
from django .contrib .auth .models import User
3
3
from django .contrib .auth .forms import UserCreationForm
4
4
from django .core .exceptions import ValidationError
5
+ from .models import Profile
5
6
6
7
7
8
class UserLoginForm (forms .Form ):
@@ -12,6 +13,7 @@ class UserLoginForm(forms.Form):
12
13
13
14
class UserRegistrationForm (UserCreationForm ):
14
15
"""Form to register new user"""
16
+ email = forms .EmailField (max_length = 75 , required = True )
15
17
password1 = forms .CharField (
16
18
label = "Password" , widget = forms .PasswordInput )
17
19
password2 = forms .CharField (
@@ -20,7 +22,10 @@ class UserRegistrationForm(UserCreationForm):
20
22
21
23
class Meta :
22
24
model = User
23
- fields = ['email' , 'username' , 'password1' , 'password2' ]
25
+ help_texts = {
26
+ 'username' : None
27
+ }
28
+ fields = ['username' , 'email' , 'password1' , 'password2' ]
24
29
25
30
def clean_email (self ):
26
31
email = self .cleaned_data .get ('email' )
@@ -40,3 +45,9 @@ def clean_password2(self):
40
45
raise ValidationError ("Passwords must match." )
41
46
42
47
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