python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

python

I want to find out if the email address "nike@yahoo.com" is in the model with field "email" , if not, return to app users , method new if User.objects.filter("email", "nike@yahoo.com") != None: return redirect("users:new")

12th Mar 2019, 3:25 AM
Instructor M
Instructor M - avatar
1 Answer
+ 1
I guess your question is related to Django. You can use Django built in method to validate email address from django.core.validators import validate_email try: validate_email(username) valid_email = True except validate_email.ValidationError: valid_email = False
17th Mar 2019, 3:52 AM
Tibor Santa
Tibor Santa - avatar