Skip to content

Instantly share code, notes, and snippets.

@deguchi
Last active January 2, 2016 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deguchi/8276552 to your computer and use it in GitHub Desktop.
Save deguchi/8276552 to your computer and use it in GitHub Desktop.
テンプレートの継承
{{ block.super }}
{{ super() }}
日付
{{ recipe.date|date:"Y-m-d" }}
{{ recipe.date|datetimeformat('%Y-%m-%d') }}
def datetimeformat(value, format='%H:%M / %d-%m-%Y'):
return value.strftime(format)
繰り返し
{{forloop.counter}}
{{loop.index}}
エスケープ
{% autoescape off %}
{% autoescape false %}
{% endautoescape %}
or
{% value|safe %}
コメント
{% comment %}
{% endcomment %}
{#
#}
ifchanged
{% ifchanged lib.city %}
{% endifchanged %}
{% for lib in libraries %}
{% if before_libcity != lib.city %}
{% set before_libcity = lib.city %}
{% endfor %}
floatformat
{{city_okper_population|floatformat}}%
{{city_okper_population|round(1, 'floor')}}%
cycle
{% cycle 'recipe_left' 'recipe_right' %}
{{ loop.cycle('recipe_left', 'recipe_right') }}
Kindのキー
.key.id
.key.id()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment