This link to a 3-step Django snippet created in 2007 still works for showing queries within a template:
http://djangosnippets.org/snippets/93/
It’s helpful for debugging pages. For example, adding the template snippet from the link above will show something like this at the bottom of your pages:
For step 3 in the link above, “Use RequestContext when rendering the current template”, include the following in your view file:
from django.template import RequestContext from django.shortcuts import render_to_response def view_news_page_by_slug(page_slug): # build your page, etc lu = { 'title': 'hooray', 'story': 'blah, blah, blah' } return render_to_response('your_template.html', lu, context_instance=RequestContext(request))
The template code from the django snippet is fairly straightforward.
To see queries from the python shell, see the django documentation for “How can I see the raw SQL queries Django is running?“
I’ve been having problems with SQL Templates, this has certainly helped me a little bit.
Thanks.