Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from django import forms
  2.  
  3. class register(forms.Form):
  4. username = forms.CharField(label = 'username', error_messages = {'Username should have only a-z , A-Z , 0-9 , _'} )
  5. email = forms.EmailField(label = 'Email id' , error_messages = {'Invalid email ID'})
  6. password = forms.CharField(label = 'password', widget = forms.PasswordInput, help_text = 'Atleast 6 characters long')
  7. confirm_password = forms.CharField(label = 'confirm password', widget = forms.PasswordInput, help_text = 'Both the passwords should match')
  8.  
  9. def validate(self):
  10. try:
  11. username = username.clean( username.value )
  12. email = email.clean( email.value )
  13. except ValidationError
  14. return 0
  15. return 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement