Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django import forms
- class register(forms.Form):
- username = forms.CharField(label = 'username', error_messages = {'Username should have only a-z , A-Z , 0-9 , _'} )
- email = forms.EmailField(label = 'Email id' , error_messages = {'Invalid email ID'})
- password = forms.CharField(label = 'password', widget = forms.PasswordInput, help_text = 'Atleast 6 characters long')
- confirm_password = forms.CharField(label = 'confirm password', widget = forms.PasswordInput, help_text = 'Both the passwords should match')
- def validate(self):
- try:
- username = username.clean( username.value )
- email = email.clean( email.value )
- except ValidationError
- return 0
- return 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement