In case this bites someone else like it bit more and chewed off many many minutes of debugging time.

If you ever get weird columns in your Django Administration interface, I now know why that happens. See this screenshot example:

Messed up columns in Django Admin

This happens when you've defined a TEMPLATE_STRING_IF_INVALID in your settings.py. I always put in my local_settings.py this line:


TEMPLATE_STRING_IF_INVALID = '{{ %s }}'

So that I can quickly see which variable references in template code is potential typos. I'm not a big fan of the implicit magic of equating absence to False/None so I try to avoid the confusion altogether.

Comments

Michael

Thanks a lot, Peter.
This saves me hours of looking for the mistake ;)

Regards from Hamburg, Germany
Michael

Your email will never ever be published.

Previous:
Automatically strip whitespace in Django forms October 12, 2009 Django
Next:
What I hate about PIL and Image in Python October 19, 2009 Python
Related by category:
How to avoid a count query in Django if you can February 14, 2024 Django
How to have default/initial values in a Django form that is bound and rendered January 10, 2020 Django
My site's now NextJS - And I (almost) regret it already December 17, 2021 Django
How to sort case insensitively with empty strings last in Django April 3, 2022 Django
Related by keyword:
ReCSS a tool to reload the CSS without reloading the whole page January 31, 2006 Web development
Javascript tip: nifty use of the console.log function in Firebug November 7, 2010 JavaScript
Review: Django 1.1 Testing and Debugging May 20, 2010 Django