我想用一行评论:
{% if something.property %}
<table>
<tr>...
{% # this is a comment %}
{% if something.property %}
<table>
<tr>...
原文由 Alex. S. 发布,翻译遵循 CC BY-SA 4.0 许可协议
我想用一行评论:
{% if something.property %}
<table>
<tr>...
{% # this is a comment %}
{% if something.property %}
<table>
<tr>...
原文由 Alex. S. 发布,翻译遵循 CC BY-SA 4.0 许可协议
注释标签记录在 https://docs.djangoproject.com/en/stable/ref/templates/builtins/#std:templatetag-comment
{% comment %} this is a comment {% endcomment %}
单行注释记录在 https://docs.djangoproject.com/en/stable/topics/templates/#comments
{# this won't be rendered #}
原文由 Miles 发布,翻译遵循 CC BY-SA 3.0 许可协议
2 回答4.3k 阅读✓ 已解决
2 回答874 阅读✓ 已解决
1 回答4.1k 阅读✓ 已解决
3 回答877 阅读✓ 已解决
2 回答2.2k 阅读✓ 已解决
4 回答2.6k 阅读
3 回答917 阅读✓ 已解决
作为 Miles 的回答,
{% comment %}...{% endcomment %}
用于多行注释,但您也可以像这样在同一行注释掉文本: