TEMPLATE_STRING_IF_INVALID

Posted: April 8th, 2010 | Author: Davo | Filed under: Django | Tags: | No Comments »

A quick way to track down the non existing variables in the template is to use the TEMPLATE_STRING_IF_INVALID.

1) set TEMPLATE_STRING_IF_INVALID in settings.py

TEMPLATE_STRING_IF_INVALID = 'VARIABLE ERROR'

2) in any template/html file:

{{ variable_which_does_not_exist }}

The variable_which_does_not_exist will be replaced by ‘VARIABLE ERROR’

Read more about how django handles invalid template variables