#NEWLINE# @ classmethod #NEWLINE# def validate( cls , username , email , password ) : #NEWLINE# #INDENT# err_msg = '' #NEWLINE# if ( not username ) : #NEWLINE# #INDENT# err_msg = 'Empty username field' #NEWLINE# raise ValidationError ( err_msg ) #NEWLINE# #UNINDENT# if ( not password ) : #NEWLINE# #INDENT# err_msg = 'Empty password field' #NEWLINE# raise ValidationError ( username ) #NEWLINE# #UNINDENT# if ( not email ) : #NEWLINE# #INDENT# err_msg = 'Empty email field' #NEWLINE# raise ValidationError ( err_msg ) #NEWLINE# #UNINDENT# validate_email ( email ) #NEWLINE# if ( User . objects . filter ( username = username ) . count ( ) > 0 ) : #NEWLINE# #INDENT# err_msg = 'Username already exists' #NEWLINE# raise ValidationError ( err_msg ) #NEWLINE# #UNINDENT# if ( User . objects . filter ( email = email ) . count ( ) > 0 ) : #NEWLINE# #INDENT# err_msg = 'Email already exists' #NEWLINE# raise ValidationError ( err_msg ) #NEWLINE# #UNINDENT# return True