[Django] #36412: Add redirect_with_message() shortcut for simplified redirects with Django messages

13 views
Skip to first unread message

Django

unread,
May 23, 2025, 9:11:56 AM5/23/25
to django-...@googlegroups.com
#36412: Add redirect_with_message() shortcut for simplified redirects with Django
messages
-------------------------------------+-------------------------------------
Reporter: Mobin-Ghaemi | Type: New
| feature
Status: new | Component: Core
| (Other)
Version: 5.1 | Severity: Normal
Keywords: shortcuts redirect | Triage Stage:
message | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
This ticket introduces a new redirect_with_message() shortcut in
django.shortcuts.

The goal is to simplify common patterns where a user is redirected to a
URL and a message is attached via Django’s messaging framework.

This new utility:

Accepts request, target url, message text, and optional msg_type (info,
success, error, etc.)

Internally calls messages.add_message() and returns HttpResponseRedirect

Enhances code readability and consistency in views

See: https://github.com/django/django/pull/19499
--
Ticket URL: <https://code.djangoproject.com/ticket/36412>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 23, 2025, 9:15:22 AM5/23/25
to django-...@googlegroups.com
#36412: Add redirect_with_message() shortcut for simplified redirects with Django
messages
-------------------------------------+-------------------------------------
Reporter: Mobin-Ghaemi | Owner: (none)
Type: New feature | Status: closed
Component: Core (Other) | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: shortcuts redirect | Triage Stage:
message | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

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

Comment:

Thank you for your suggestion! When suggesting a new feature for Django,
the feature idea should first be proposed and discussed with the
community. To do that, please raise this on the
[https://github.com/orgs/django/projects/24 ​new feature tracker].

I'll close the ticket for now, but if the community agrees with the
proposal, please return to this ticket and reference the discussion so we
can re-open it. For more information, please refer to
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features the documented guidelines for requesting
features].
--
Ticket URL: <https://code.djangoproject.com/ticket/36412#comment:1>

Django

unread,
May 24, 2025, 1:07:19 AM5/24/25
to django-...@googlegroups.com
#36412: Add redirect_with_message() shortcut for simplified redirects with Django
messages
-------------------------------------+-------------------------------------
Reporter: Mobin Ghaemi | Owner: (none)
Type: New feature | Status: closed
Component: Core (Other) | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: shortcuts redirect | Triage Stage:
message | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mobin Ghaemi):

https://forum.djangoproject.com/t/account-temporarily-on-hold/41074/2
Please re-open if acceptable. Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/36412#comment:2>
Reply all
Reply to author
Forward
0 new messages