Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django import forms
- from django.contrib.auth.models import User
- class SignUpForm(forms.ModelForm):
- dupa = forms.CharField(max_length=300)
- password = forms.CharField(widget=forms.PasswordInput())
- confirm_password = forms.CharField(widget=forms.PasswordInput())
- class Meta:
- model = User
- fields = ('first_name', 'last_name', 'password')
- def clean(self):
- cleaned_data = super(SignUpForm, self).clean()
- password = cleaned_data.get("password")
- confirm_password = cleaned_data.get("confirm_password")
- if password != confirm_password:
- raise forms.ValidationError(
- "password and confirm_password does not match"
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement