Saturday, May 25, 2013

Passing filter parameters to admin's add view

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJRoN5cAAoJEFjlhRo+xFTEQNgP/1YKEliMwdV44Hca9uZDfSxq
freti7AvjtDZzz5juMelgDeR+ZPJAmd4yscD6xaliCs9hdfza6hhvbHfXALkIFN3
oYkxtIkL81LefnIRaUzrLidxe4V0xsa2BuL7+ippyImBEqy6C7gR1ToLUGGgK/Fu
1wOkgjSeeajgIqTZ20/uD1HF00nv3FkV61JcNSjBYyKm+l7r6Jm3ou5IrDUBmjja
MIn/N6UsaH8d59WUk40YUlfnnRxsi7MpH83rkRs0K5uPqOEI1v8lZc9sHSG2/4lj
rh8JIQZE6pTgKzdYo8LsHzMAqPLGvl4nnsqElrcKeZ5YYWpJQVP0MUXc8SZwxVyY
iHNZyTqtHGbXs6jNsvDimR2H8WGxFvFx541Imb3rh3S4L3ocmtevES2eRfJeCv4c
1x6Pb2KnANo4n4XC0Sfbvvnyh1xvUXPx7pSf7FAiBsnsSLxJuLGrxk6AU3xYbe2Y
OGzNWOaL1KadoBDha3o5m7OKRUiCKXZ4excKSbHnnBqACY1GkHuCaK1YOfAJzdtw
QFi3Qqb2Es0acgs0EOUcym7YPxwIC1I2IBlQFwVC+P0WuvKLNSwr3tG69chydgRH
dA2xz4pGMS/CA0Z0nlTT+qzM0WhKyCB/Byg9VhEQWfwz0gU9qTlrr5kZtnr9lM/m
PC4Vb1NR/iePWaMd/axv
=Gn1y
-----END PGP SIGNATURE-----
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: branko@majic.rs
Please use only Free formats when sending attachments to me.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate