[英]Using conditions with django template tags/filters?
If I'm using {% spaceless %}<html></html>{% endspaceless %}
in my templates, but I only want the spaceless function on only when I'm not debugging, how can do this?如果我在我的模板中使用{% spaceless %}<html></html>{% endspaceless %}
,但我只希望在我不调试时才使用 spaceless function,怎么做? I tried using {% if %}{% spaceless %}{% endif %}
, but that's an error.我尝试使用{% if %}{% spaceless %}{% endif %}
,但这是一个错误。
Thanks!谢谢!
I wrote just such a tag and put it on Django Snippets: http://djangosnippets.org/snippets/2405/ Enjoy!我只写了这样一个标签并将其放在 Django 片段: http://djangosnippets.org/snippets/2405/享受!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.