-2👍
✅
You can modify the dict that you passed to render_to_response so that it contains the list of variables.
In your views.py:
dic = {'a':1, 'b':2}
dic['keys'] = dic.keys()
return render_to_response('your_template.html', dic)
Then in your template:
{% for variable in keys %}
{{ variable }}
{% endfor %}
4👍
I usually have django-debug-toolbar installed. It gives you all that information and much more.
- [Answered ]-Python Django Multiple Database Committing Objects with Foreign Key Relations
- [Answered ]-Django: Signal callback function missing foreign on model
- [Answered ]-Setting background image in base template in Django
Source:stackexchange.com