Guest User

Untitled

a guest
Feb 19th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1.  def clean_listname(self):
  2.         cleaned_data = super(ListNew, self).clean()
  3.         listname = cleaned_data.get('listname')
  4.         try:
  5.             validate_slug(listname)
  6.         except:
  7.             raise forms.ValidationError(_("Please enter a valid listname"))
  8.         return listname
  9.  
  10.  
  11.  
  12. -----------------------------------------------------------------------------------
  13.  
  14.  
  15.  def clean_password(self):
  16.         password = self.cleaned_data.get('password')
  17.         password_repeat = self.cleaned_data.get('password_repeat')
  18.         if password != password_repeat:
  19.             raise forms.ValidationError("Passwords must be identical.")
  20.         return password_repeat
  21.  
  22.     def clean_email(self):
  23.         email = self.cleaned_data['email']
  24.         try:
  25.             validate_email(email)
  26.         except:
  27.             raise forms.ValidationError(_("Please enter a valid email ID"))
  28.         return email
  29.  
  30.  
  31. ------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment