Reputation: 1061
Looking for a solution to read the complete list of variables that can be passed into a context and displayed within a template, using either Django or Jinja2.
For example, something like this in Django:
from django.template import Template
template = Template("<h1>{{title}}</h1>{%for v in values%}<p>{{v}}</p>{%endfor%}")
for node in template.nodelist:
#Get the variable name from the node
This seems like a real pain. All I want is a list of the keys that a context object could pass to the template, in this example, "title" and "values"
Upvotes: 0
Views: 313
Reputation: 15718
You could use {% debug %} tag
debug
Outputs a whole load of debugging information, including the current context and imported modules.
Also if you want even more you could use Django debug toolbar
Upvotes: 2