User matching query does not exist.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

User matching query does not exist.

göktürk sığırtmaç
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 this

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)

 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: User matching query does not exist.

Gabriel Stone
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ç <[hidden email]> 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 this

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)

 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com.
--
Gabrielstone😎

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-5MpWb6fpUZs%3Dvrztc%3DjN8RaUNYax1nwGXegR1J-cG0Mk2dA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: User matching query does not exist.

göktürk sığırtmaç
Yes i get name email password in register, i get email and password in login 

7 Eylül 2019 Cumartesi 23:47:41 UTC+3 tarihinde Gabriel Stone yazdı:
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ç <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="J8K1BI6XGgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">s.gok...@...> 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 this

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)

 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="J8K1BI6XGgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/985ce3b9-2810-48ef-9840-e18515109f4b%40googlegroups.com.
--
Gabrielstone😎

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/449722c8-b307-4001-aac6-cf4102e30bb4%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: User matching query does not exist.

göktürk sığırtmaç
In reply to this post by göktürk sığırtmaç
I solved it!!! using ObjectDoesNotExist via javatpoint. (https://www.javatpoint.com/django-exceptions

try:
user = User.objects.get(email=email)
except ObjectDoesNotExist:
user = None;

7 Eylül 2019 Cumartesi 23:36:00 UTC+3 tarihinde göktürk sığırtmaç yazdı:
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 this

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)

 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b36cb1f-d42c-4783-86a7-fcfaf0cbfb99%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: User matching query does not exist.

Gabriel Stone
Tamam all the best

On Sat, Sep 7, 2019 at 23:12 göktürk sığırtmaç <[hidden email]> wrote:
I solved it!!! using ObjectDoesNotExist via javatpoint. (https://www.javatpoint.com/django-exceptions

try:
user = User.objects.get(email=email)
except ObjectDoesNotExist:
user = None;

7 Eylül 2019 Cumartesi 23:36:00 UTC+3 tarihinde göktürk sığırtmaç yazdı:
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 this

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)

 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b36cb1f-d42c-4783-86a7-fcfaf0cbfb99%40googlegroups.com.
--
Gabrielstone😎

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-5MpV8y_rfdDxDR7KsgCeD%3Dys3aQALvi_yOGeWOyYqtBrw_Q%40mail.gmail.com.