[Django] #28644: Messages not Displaying After Redirect

21 views
Skip to first unread message

Django

unread,
Sep 27, 2017, 7:36:42 PM9/27/17
to django-...@googlegroups.com
#28644: Messages not Displaying After Redirect
--------------------------------------------+--------------------------
Reporter: Nirmal Natarajan | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 1.11
Severity: Normal | Keywords: messages
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+--------------------------
I have this piece of code in my view:

{{{
if _user.objects.user_exists(_email):
auth.logout(request)
messages.success(request, 'You already hold a verified account with
us. Please login.')
return redirect('accounts:login')
}}}

and this in my template:

{{{
{% if messages %}
{% for message in messages %}
<div>{{ message }}</div>
{% endfor %}
{% endif %}
}}}

This sadly wouldn't work. But if I change redirect('accounts:login') to
render(request, 'accounts/login.html'), the message would display.

And for the message storage, I am using:

{{{
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28644>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 27, 2017, 8:33:30 PM9/27/17
to django-...@googlegroups.com
#28644: Messages not Displaying After Redirect
----------------------------------+--------------------------------------

Reporter: Nirmal Natarajan | Owner: nobody
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.11
Severity: Normal | Resolution: needsinfo

Keywords: messages | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => needsinfo


Comment:

I can't reproduce the issue given the details you provided. Ideally, you
could debug the problem enough to explain why Django is at fault. If you
can't do that, you can ask for help in confirming the bug using our
[wiki:TicketClosingReasons/UseSupportChannels support channels]. Please
reopen with a minimal project that reproduces the issue if a bug is
confirmed. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/28644#comment:1>

Django

unread,
Sep 27, 2017, 10:08:00 PM9/27/17
to django-...@googlegroups.com
#28644: Messages not Displaying After Redirect
----------------------------------+--------------------------------------

Reporter: Nirmal Natarajan | Owner: nobody
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.11
Severity: Normal | Resolution: needsinfo

Keywords: messages | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by Nirmal Natarajan):

Thank you, Tim Graham. Your confirmation helped me look at other places
and found that the session cookie's domain setting was the problem. So
obviously the production setting was failing while developing on
localhost.

--
Ticket URL: <https://code.djangoproject.com/ticket/28644#comment:2>

Django

unread,
Sep 28, 2017, 6:48:56 AM9/28/17
to django-...@googlegroups.com
#28644: Messages not Displaying After Redirect
----------------------------------+--------------------------------------

Reporter: Nirmal Natarajan | Owner: nobody
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: messages | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Tim Graham):

* resolution: needsinfo => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/28644#comment:3>

Reply all
Reply to author
Forward
0 new messages