Allow for strict mode in templates

75 views
Skip to first unread message

Michael Hübner

unread,
Aug 21, 2022, 12:24:38 PM8/21/22
to Django developers (Contributions to Django itself)
I was struggeling with a get query that just wouldn't throw any exceptions. Then I stubled about this:

https://code.djangoproject.com/ticket/11909

I'm so sorry about the rude request in there, but it would be really helpful to allow for a "strict mode" in templates where errors get thrown to help debug issues.


Adam Johnson

unread,
Aug 21, 2022, 6:30:50 PM8/21/22
to Django developers (Contributions to Django itself)
Django logs warnings for missing variables. I believe this logging was added since that ticket was closed.

I recently wrote a blog post with some techniques you can use to hook into this logging and turn those errors into exceptions: https://adamj.eu/tech/2022/03/30/how-to-make-django-error-for-undefined-template-variables/ . I hope that helps.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0b926630-6832-48a0-8377-c74d93c55a83n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages