This is a draft cheat sheet. It is a work in progress and is not finished yet.
Template filters
|lower |
|date: format |
|upper |
|time: format |
r |title |
|timesince[: datetime] |
|capfirst |
|length |
|slugify |
|length_is: length |
|ljust: width |
|first |
|rjust: width |
|last |
|center: width |
|random |
|wordwrap: width |
|join: string |
|striptags |
|slice: "1:9" |
|cut: substring |
|divisibleby: number |
|truncatechars: count |
|floatformat[: decimal_places] |
QuerySet API
all |
filter |
filter(**kwargs) |
exclude |
exclude(**kwargs) |
annotate |
annotate( models.Count('cost') ) |
order_by |
*fields_str] |
reverse |
distinct |
values |
*fields_str |
values_list |
*fields_str |
date(time) |
dates(field, kind, order) |
none |
extra |
extra(select={}) |
create |
create( **kwargs ) |
get |
get( **kwargs ) |
get_or_create |
get_or_create( **kwargs ) |
count |
latest |
aggregate |
aggregate( models.Count('entry') ) |
delete |
|
|
Field Lookups
__exact |
__iexact |
Case Insensitive |
__contains |
__icontains |
__in |
Pass in a list |
__gt, __gte, __lt, __lte |
__startswith, __istartswith, __endswith, __iendswith |
__range |
(inclusive) =(X, Y) |
__year, __month, __day, __hour, __minute, __second |
__week_day |
1=Sun, 7=Sat |
__isnull |
__regex |
Django templates
{% cycle %} |
{% debug %} |
{% extends "" %} |
{% filter %} {% endfilter %} |
{% firstof %} |
{% for in %} {% empty %} {%endfor%} |
{% ifchanged %} {%endifchanged%} |
{% ifequal %} {% endifequal %} |
{% include %} |
{% now "" %} |
{% regroup by as %} |
{% spaceless %} {% endspaceless %} |
{% ssi %} |
{% url %} |
{% verbatim %} {% endverbatim %} |
{% with as %} {% endwith %} |
{% blocktrans with as %} {% endblocktrans %} |
|
|
|