views:

48

answers:

2

i want to pass a variable by URL to another page in django admin. it seems it is not working, i want to pass the variable "/?name=hello", and catch it by request.GET.get["name",""].but the url becomes "/?e=1" after it passed. if i use the default parameter'q', it works, but it will have a conflict. it seems this problem is django-admin only. and i need pass it by url not post... does any one knows how to solve this problem

thanks

A: 

Can you explain your problem a bit more....why do you want to pass a variable to django admin... also you cant catch GET variable like this... Either use:

request.GET['name'] 

or

request.GET.get('name','')

.get is a instancemethod not a dictionary.

dcrodjer
i used it request.GET.get('name',''). i want to pass the varible to admin to tell, which reports to show up. q=0 to show the reports who submitted. q=1 to show the rpoets who is been assigned and etc.
Grey
i can only do that by use parameter q. which q is used by search filed. it was fine. but now i need to use search field. and q will be used for that. so i need to really fix it.
Grey
u may think why i dont think POST. that reason is that, if there is more reports that one page can show. djang admin use p=1, p=2 to use multiple pages to show all report. but if i dont use GET it will loose track
Grey
Can you post your models. Do you want to filter the admin site results ? I think what you want is a list_filter = ['field1', 'field2'] option in the admin.py of your model.This will add a filter similar to what you want to achieve through get.
dcrodjer
A: 

Im sitting trying to solve this one as well. I can pass arguments in by having a form on one of the change-lists and overriding the queryset method in admin. However it will not remember the arguments unless I get them in the url for some reason. Any ideas?

kman
so far. i havent figure it out yet.. currently i am using javascript to hack it in order to make it work.
Grey
OK, would you mind sharing the solution? Im thinking bout writing a filter cos that would make the parameters stick.
kman