#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.7ab4049435fc54323eb1cd93377b1594%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.