目次 djangoテンプレート内ので条件分岐(IF文) テンプレート内条件分岐の基本形 条件分岐で利用できる演算子 条件分岐の例 テンプレート内ので条件分岐(IF文)には注意が必要な点がある 注意点1:条件式内で丸括弧は使えない 注意点2:複数条件指定時は暗黙のグループ化ルールに気を付ける djangoテンプレート内ので条件分岐(IF文) djangoテンプレート内で{% if %}で条件分岐するやり方と注意点についてまとめます。 テンプレート内条件分岐の基本形 djangoテンプレート内で使える条件分岐の基本形は。 {% if ..... %} ・・・・ {% elif ...... %} ・・・・ {% else %} ・・・・ {% endif %} です。 elifは何回でも繰り返し使えます。 条件分岐で利用できる演算子 利用できる演算子は。 演算子 用途 例 == 値が等しい