-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b67909
commit dc2431b
Showing
6 changed files
with
53 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +0,0 @@ | ||
from django import forms | ||
from django.contrib.auth.models import User | ||
from django.contrib.auth.forms import UserCreationForm | ||
|
||
class RegistrationForm(UserCreationForm): | ||
email = forms.EmailField(required = True) | ||
profile_pic = forms.ImageField(required=False) | ||
|
||
class Meta: | ||
model = User | ||
fields = ( | ||
'username', | ||
'first_name', | ||
'last_name', | ||
'email', | ||
'password1', | ||
'password2', | ||
'profile_pic' | ||
) | ||
|
||
def save(self, commit=True): | ||
user = super(RegistrationForm, self).save(commit=False) | ||
user.first_name = self.cleaned_data['first_name'] | ||
user.last_name = self.cleaned_data['last_name'] | ||
user.email = self.cleaned_data['email'] | ||
|
||
if commit: | ||
user.save() | ||
|
||
return user | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters