Print CGI / META /QUERY_STRING in Django Template

Posted by: scoopseven 13 years ago

Differentiating how to display or access variables/structures/dictionaries in Django templates (as opposed to views) can get frustrating. All I was trying to do was print the query string in a template. That's. It. Why couldn't I just do: {{request.META['QUERY_STRING']}} Oh yea, because you can't access a dictionary with that notation in templates... FTW! Here's the correct (and hard to find solution). {{request.META.QUERY_STRING}} This correctly outputs the whole query string in your template.

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom