views:

22

answers:

1

I want to modify the django admin for a particular model to provide the following behaviour.

A user make a search on the change_list page. The the user click a specific entry and he lands on the change_form for that entry. Nothing different to the usual.

Now, what I want is a mean to navigate the former search results. Basically next and previous buttons on the edit page.

What would be the best approach to implement this feature without modifying the admin site too much?

I will need to memorize the search in the user session, then when an entry is clicked I will need to known which place it has within the results to place my "cursor" accordingly. But I'm a bit in the cloud as the implementation side.

A: 

One way is to just put the next and previous button in the template for that particular model. This can be implemented using simple javascript.

anand
Yea, where do you put/save the list of results to navigate in?
Nicolas Goy
list of results?
anand
Yea, the user does a search, and I want the next and previous button to navigate within the results of that search.
Nicolas Goy
whenever a search is made the parameters go as a GET request by default in admin. So, <INPUT TYPE="button" VALUE="BACK" OnClick="history.go( -1 );return true;"><INPUT TYPE="button" VALUE="FORWARD" OnClick="history.go( 1 );return true;"> should work fine.
anand
No, I don't want to navigate the history, I want to navigate the list of results. So if the search returns objects a, b and c and if the user clicks b, he will be on the edit page for object b, with button previous to edit object a and button next to edit object c.
Nicolas Goy
ahh.. your requirement is totally different what I was thinking of. Well, then in that case what I can think of is to store all the search results keys in some kind of list and then move backward or forward using the list index.
anand