views:

21

answers:

1

Is it correct to say that there is no simple tag that just writes some http get query parameter? If all needed is printing a http get query parameter e.g. ?q=w can I directly use the value q with a template tag or need the copy the value in the request handler? Is it possible to more directly pass values (all values) from http get to template? Because copying every value seems repeating the same handling many times

template_values = {'q':self.request.get('q'),...

It should be possible to iterate the parameter set. Can you recommend that or other related handling?

+2  A: 

You don't need to do this at all. The request is available in the template context automatically (as long as you enable the request context processor and use a RequestContext) - or you can just pass the request object directly in the context.

And request.GET is a dictionary-like object, so once you have the request you can get the GET values directly in the template:

{{ request.GET.q }}
Daniel Roseman
That's great to know exactly what I was looking for. Thanks!
LarsOn