我想用一行评论:
{% 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.9k 阅读✓ 已解决
2 回答1k 阅读✓ 已解决
3 回答1k 阅读✓ 已解决
4 回答818 阅读✓ 已解决
3 回答1.1k 阅读✓ 已解决
1 回答1.6k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
作为 Miles 的回答,
{% comment %}...{% endcomment %}
用于多行注释,但您也可以像这样在同一行注释掉文本: