Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SignUpForm(forms.ModelForm):
- confirm_password = forms.CharField(max_length=50)
- class Meta:
- model = User
- fields = ['password', 'email', 'first_name', 'last_name']
- def is_valid(self):
- if super(SignUpForm, self).is_valid() and self.confirm_password == self.instance.password:
- return True
- else:
- False
- def save(self, commit=True):
- if self.is_valid():
- self.instance.objects.create_user(username=self.instance.email, email=self.instance.email,
- password=self.instance.password, first_name=self.first_name,
- last_name=self.last_name).save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement