#13081: Admin actions loose get-parameters in changelist view
----------------------------------+-----------------------------------------
Reporter: joh | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------------+-----------------------------------------
If the actions from the admin changelist view are used, the user will be
redirected to the changeliste view, but if a filter or search was active,
this information will be lost after redirection.
We discovert this behaviour as problematic in different satchmo/django-
based shops we are hosting. If our users filter products for a specific
category and use an action to mark some of them as featured products, they
will end up in the changelist view, but see all products again. This also
affects pagination in changelist views, because this information is also
lost after redirection. Most of our users expected these filters to be
remembered after action usage.
I stripped down the reason to the package
{{{django.contrib.admin.options}}} in the class {{{ModelAdmin}}}. The
method {{{response_action}}} will return a {{{HttpResponseRedirect('.')}}}
when the action itself does not return a response. The Location-header
will then be "fixed" in {{{django.http.utils}}} in the function
{{{fix_location_header}}}. This function seems to enable some kind of
"relative redirection feeling" in django. It uses
{{{HttpRequest.build_absolute_uri}}}.
A simple fix / enhancement would be to change
{{{ModelAdmin.response_action}}} to return
{{{HttpReponseRedirect(request.build_absolute_uri())}}} if the action
itself does not return a response. Alternative would be to use
{{{HttpReponseRedirect('')}}}, but I am not sure if this is a "clean" way.
I will attach patches for both variants shortly.
--
Ticket URL: <http://code.djangoproject.com/ticket/13081>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.