1

I want to create custom django admin template and pass there some data. Is it possible to access GET query in custom template ?

1 Answer 1

3

The request object should be injected into all templates, so yes, you can access the GET dictionary.

{{ request.GET.my_param }}
Sign up to request clarification or add additional context in comments.

6 Comments

I try to print out value of get request by creating the following template dropbox.com/s/37o6ywocu3biapj/… . admin form prints out, but my_param - not
Can you double check that 'django.template.context_processors.request' is in your TEMPLATE context_processors setting?
Interesting. And your url has the parameter in it? somehting like this? /admin/something?my_param=something
yes, like this 127.0.0.1:8000/admin/core/orderingsettings/?my_param=hello. after request submit it looks like 127.0.0.1:8000/admin/core/orderingsettings/?e=1
That is odd. you should be able to access it through {{ request.GET.e }}
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.