06. Django template language DTL

codering

{%                                      %}

extends "base.html

csrf_token

load static
load tz   indien USE_TZ = TRUE
load l10n   indien USE_L10N = TRUE
load i18n

 

block content
endblock | endblock content

 

block title
endblock title

 

block body
endblock body

 

for .... in .....

empty

    <li> set is empty </li>

            endfor

            for member in owner.member_set.all

            value|default: "....."

value|length
value|filesizeformat

if var1

{ { var1 } }

elif var2

{ { var2 } }

else
endif

firstof var1 var2 var3
forloop.counter
forloop.first
forloop.last

if var == '....'
if var != '....'
if var < ...

>
<=
>=

if var is True
if var is None
if var is not True
if var is not None
if a<b and c<d
if a>b or c<d
if messages|length >= 100

ifequal a b
endifequal

ifnotequal a b
endifnotequal

ifchanged
endifchanged

comment
endcomment

include ".....html'

now "d-m-Y"

url ' '

 

variabel

{ {                                           } }

object
object.veld

value | capfirst
value | center: "15"
value | cut: "b"
value | date: "d/m/Y/H"
value | date: "SHORT_DATE_FORMAT"
value | default: " "
value | dictsort: " "
value | divisibleby: " "
value | first
value | floatformat: "-3"
value | git_digit: "2"

value | join: "// "

value | last
value | length
value | lower
value | ....

commentaar

{# dit is commentaar #}

 

gebruik django-html package in atom