Monday, May 27, 2013

Re: Passing filter parameters to admin's add view

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

iQIcBAEBAgAGBQJRox/4AAoJEFjlhRo+xFTESaUP/2gOGXCXtopkmZKNWrEdQSpK
QwJamgfJ9M5JGRkHOQpeJJ8JDS/cWfAKXhuQIuvpSdiWRSQLqz/4PlR8CAZqY4v6
3jSfy01vuIN86PoDzxBROwPiX55OLcngCvUwKWg0jAPT9wJpSaWRGt22rMowp8U6
TE9hB7CVD3DeHVgFnLcZjASpmAERBOcKtkdYdAhqe6DUc6Z6oHb3biV+YB7tdXZc
AyjqyWfMTLvv3+wC0vuzqmHyGazDGfBEeTV0LdfOWIejoGwhMVU0Pqi0mUlCQciK
6FDNKR+Xd0TBGgxy4/auNZEUn/gfQ6+d1TyZ4+JCe9nHkQGBx0B1ApqyuwuuvtoP
v23b3U0JwSS5gyPcTqr9lX2RtwDCbcRWzVo+bZYxGWHS0CHS5ShquiiegikkAufZ
5Q4jRWkikeAVkP+LAR2SfAQAfHWQMkmi7P0DXK6IG0XKdnblJ2o9YKn6ekjpJUV2
KdzOGHiYYWOxJpo3EtGC3KEg08I6rgxLA/QWGx+oW13TPLorAQyW2FEUknedPUYf
N8T5C0pYUQzQcGeZxgcIW6OMO3AdlV7v++THMxRyiUWV7twPXLoH5XFCBR0AY3kb
aSxYUwwSJpUD1ASr+YHNFPEAoth3ILw+HkFNStVVIibCx5rbO0hMAAg2gx3Bdw3L
k5h4GVHUXLOacsS8HdZN
=oZli
-----END PGP SIGNATURE-----
No problem, happens to me sometimes as well :)

The only reason I thought there might be another way is that it feels a
bit tedious, and I'd expect people need this kind of functionality
quite often. I was wondering if there might be some sort of shortcut for
it.

I'll stick with the template override method for now, though -
thanks for the answer :)

Best regards

On Sun, 26 May 2013 17:40:16 -0700 (PDT)
Marc R <warath@gmail.com> wrote:

> Sorry, didn't read to the bottom of your post :)
>
> Why would there be a better way than overriding the default template? that
> is the most efficient way and the power of frameworks.
>
> On Saturday, May 25, 2013 11:53:00 AM UTC-4, 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 <javascript:>
> > Please use only Free formats when sending attachments to me.
> >
> > Бранко Мајић
> > Џабер: bra...@majic.rs <javascript:>
> > Молим вас да додатке шаљете искључиво у слободним форматима.
> >
>



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

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

No comments:

Post a Comment