Monday, May 27, 2013

Re: Passing filter parameters to admin's add view

This may be a "red herring", but its also worth looking at how middleware handles things:
http://www.b-list.org/weblog/2006/jun/13/how-django-processes-request/

On Saturday, 25 May 2013 17:53:00 UTC+2, Branko Majic wrote:
Hello all,

I've posted a similar question a couple of months ago, but received no
answer. I'm repeating the question now, but hopefully making it a bit
clearer on what I desire to achieve.

Is there any way to have the admin app pass the currently set filter
(GET prameters) to the "add view"?

For example, let's say that the following page is open:

http://localhost:8000/admin/conntrackt/entity/?project__id__exact=1

By default the page will contain the "Add item" link as:

http://localhost:8000/admin/conntrackt/entity/add/

What I'm interested in doing would be to have this link instead as:

http://localhost:8000/admin/conntrackt/entity/add/?project__id__exact=1

The idea is to take advantage of the current filter in the list view in
admin in order to limit the foreign key fields when adding a new
entity.

I've already implemented this by overriding the admin's
change_list.html template, but I'd be a bit surprised that there isn't
a better way to perform this.

Best regards

--
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate