我想区分layout.html
中某个工具栏的外观,具体取决于DEBUG = True还是不是。如何在django模板中检查DEBUG true/false - 完全在layout.html
我知道使用django.core.context_processors.debug
这answer但它迫使我使用RequestContext
代替Request
我不是很喜欢,顺便说一句我该如何使用RequestContext的为layout.html
延伸base.html
?
而且通常有一些更好的方法比提到一个或the one using custom template tag?
我目前的Django 1.7
这实际上是一样的问题,因为http://stackoverflow.com/questions/1271631/how-to-check-the-template-debug-flag-in-a-django-template/1271914,答案应该可能是在那个线程中。 (这个问题的答案基本上与其他线程中接受的答案一样)。 – mipadi 2015-09-24 15:18:38