user = User.objects.get(email=email)
try:
user = User.objects.get(email=email)
except:
user = None;
if user is None:
messages.warning(request, "Email hatalı")
print("email is wrong")
return render(request, "login.html", context)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com.
In your user creation form did you add an email field?if you did then only can you query users by their email
On Sat, Sep 7, 2019 at 22:36 göktürk sığırtmaç <s.gok...@gmail.com> wrote:
I'm trying get user according to email.user = User.objects.get(email=email)if user is none, i will show message. I will check password after. But when i trying login with wrong email address for test i have error "User matching query does not exist.". How can i handle this error to convert message. I have tried thistry:
user = User.objects.get(email=email)
except:
user = None;
if user is None:
messages.warning(request, "Email hatalı")
print("email is wrong")
return render(request, "login.html", context)code but my each login attempt, i have message "e mail is wrong"--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com.
--Gabrielstone😎
try:
user = User.objects.get(email=email)
except ObjectDoesNotExist:
user = None;
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b36cb1f-d42c-4783-86a7-fcfaf0cbfb99%40googlegroups.com.