Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I list all available context variables?

I'm new to django templates, and I'm trying to tweak the admin interface. Right now I'm editing tabular.html in order to control how inlines are displayed. However, I have no idea what variables are available via the context the admin app sends to this template. Is there any quick way to see all variables available?

I know it is possible to use assert False in a .py-file, is there some equivalent in a template file?

like image 855
Kristian Avatar asked Dec 09 '22 16:12

Kristian


1 Answers

Use Django debug toolbar and make sure settings.py has:

DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TEMPLATE_CONTEXT': True,
}
like image 127
Aaron C. de Bruyn Avatar answered Jan 29 '23 03:01

Aaron C. de Bruyn