2021年11月22日 星期一

Python Django Template 語法(7)

在template中的註解
{# template中的註解寫法單行 #}
{% comment %}
template中的註解寫法多行
{% endcomment %}
if esle
{% if xxx == 5 %}      
{% elif xxx > 4  %} 
{% else %}
{% endif %} 
for迴圈
{% for xxx in result%}   
    {% comment %}      
    以下內容可試看看      
    forloop.counter0
    forloop.counter
    forloop.revcounter
    forloop.revcounter0
    forloop.first
    forloop.last
   {% endcomment %}   
   {{forloop.counter}}
    
{% empty %}
	無資料!!
{% endfor %}