Django Cup Sheet Cheat Sheet: by Via

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

django cup sheet Cheat Sheet

by Byyn via cheatography.com/76945/cs/18905/

Template filters Field Lookups

|lower |date: format __exact

|upper |time: format __iexact Case Insens​itive

r |title |times​ince[: datetime] __contains

|capfirst |length __icon​tains

|slugify |lengt​h_is: length __in Pass in a list

|ljust: width |first __gt, __gte, __lt, __lte

|rjust: width |last __star​tswith, __ista​rts​with, __ends​with,


__iend​swith
|center: width |random
__range (inclu​sive) =(X, Y)
|wordwrap: width |join: string

|striptags |slice: "​1:9​" __year, __month, __day, __hour, __minute,


__second
|cut: substring |divis​ibleby: number
__week_day 1=Sun, 7=Sat
|trunc​ate​chars: |float​for​mat[:
__isnull
count decima​l_p​laces]
__regex
QuerySet API
Django templates
all

filter filter​(**​kwargs) {% cycle %}

{% debug %}
exclude exclud​e(**​kw​args)
{% extends "​​" %}
annotate annotate( models.Co​unt​('c​ost') )
{% filter %} {% endfilter %}
order_by *field​s_str]

reverse {% firstof %}

distinct {% for in %} {% empty %} {%endfor%}

values *field​s_str {% ifchanged %} {%endi​fc​​han​ged%}

{% ifequal %} {% endifequal %}
values​_list *field​s_str
{% include %}
date(time) dates(​field, kind, order)

none {% now "​​" %}

extra extra(​sel​ect={}) {% regroup by as %}

{% spaceless %} {% endspa​​celess %}
create create( **kwargs )
{% ssi %}
get get( **kwargs )

get_or​_create get_or​_cr​eate( **kwargs ) {% url %}

{% verbatim %} {% endver​​batim %}
count
{% with as %} {% endwith %}
latest
{% blocktrans with as %} {% endblo​​ck​trans %}
aggregate aggregate(
models.Co​unt​('e​ntry') )

delete

By Byyn Not published yet. Sponsored by ApolloPad.com


cheatography.com/byyn/ Last updated 20th February, 2019. Everyone has a novel in them. Finish Yours!
Page 1 of 1. https://apollopad.com

You might also like