Friday, June 18, 2010

Re: admin filters getting reset after admin action

On Jun 18, 8:18 pm, swinton <stevewin...@gmail.com> wrote:
> On Jun 17, 4:13 pm, derek <gamesb...@gmail.com> wrote:
>
> > On Jun 17, 5:44 am, rahul jain <jainwolver...@gmail.com> wrote:
>
> > > Hi there,
>
> > > I have some filters set-up on admin page. As soon as I perform admin
> > > action. All filters are getting reset.
>
> > > Is this is a bug from framework ?
>
> > No.  There are work-arounds to get back to these; Google this group
> > for suggestions.
>
> Hi there,
>
> I'm trying to do the same (retain admin filters after action). I've
> searched this group for suggestions, but have failed to come up with
> anything. Can anyone give me some pointers?
>
> Thanks,
> Steve

Hmmm, worked out a solution on my own, although I'm sure it's less
than optimal.

I'm just returning an HttpResponseRedirect from my action, passing in
the various query string parameters that may or may not have been set
by the filters, e.g. something like:

# Retain filters
params = {}

if 'foo' in request.GET:
params['foo'] = request.GET['foo']
if 'bar' in request.GET:
params['bar'] = request.GET['bar']

return HttpResponseRedirect("/admin/app/model/?%s" %
urlencode(params))

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate