Hi,
I've recently discovered the possibility to add a `reason` to a redirect.
It's extremely useful for testing or debugging when a redirect to a same
page can have different causes.
I'm proposing to add this functionality to `django.shortcuts.redirect` :
def redirect(to, *args, reason=None, p
This sounds reasonable, but unfortunately, it's backwards incompatible and
so we cannot make the change. Any URL with a “reason” URL parameter would
no longer be resolvable.
You can make a project-specific shortcut function that allows providing the
reason parameter. Since it’s two lines long, it’
> it's backwards incompatible and so we cannot make the change. Any URL with a
> “reason” URL parameter would no longer be resolvable.
I think if we decided this feature was sufficiently worthwhile, we could find a
way to overcome the backward compatibility problem (a deprecation cycle, with
pe
It is already implemented in my projects.
So far, my main use cases are for the testing of views or their debugging.
When several reasons can lead to a redirect to the same address or view, it
allows me to ensure that the redirect is because of the reason I'm
expecting.
I think it's a good tool.