def validate_password(password): letter = False number = False up = False low = False for x in password: if x.isalpha(): letter = True if x.isdigit(): number = True if x.isupper(): up = True if x.islower(): low = True if letter is True and number is True and up is True and low is True: return password raise ValidationError("Enter valid password")
def validate_title(title): for x in title: if x[0].isupper() and x.isalpha(): return title raise ValidationError("Enter valid titel")
def validate_gender(gender): if gender == 'male' or gender == 'female': return gender raise ValidationError("Enter valid gender")
def validate_age(age): if age.isdigit(): return age raise ValidationError("Enter valid age")
def check_if_letter(word): if word.isalpha(): return word raise ValidationError("Enter valid first_name or last_name")
def validate_email(email): if "@" in email: return email raise ValidationError("Enter valid email")
def validate_nickname(nickname): if nickname.islower(): return nickname raise ValidationError("Enter valid nickname")