How to get GET request values in Django Templates?

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 }}

Leave a Comment