Search code examples
pythondjangodjango-viewsgeturl-parameters

How to get GET request values in Django Views?


Suppose I have a url that has php style parameters, that is:

http://example.com/blah?param1=val1&param2=val2

And, I want to place their values into the generated HTML of the template.

How do I achieve this?


Solution

  • {{request.GET.param1}} in the template. (Using RequestContext)

    request.GET.get('param1', None) in the view.