Cheatography
https://cheatography.com
Snippets for Django templates
autoescape |
{% autoescape %} {% autoescape %}
|
block |
{% block %} {% endblock %}
|
comment |
{% comment %} {% endcomment %}
|
csrf |
|
cycle |
|
debug |
|
ext |
|
extends |
|
filter |
{% filter %} {% endfilter %}
|
firstof |
|
for |
{% for in %} {% endfor %}
|
fore |
{% for in %} {% empty %} {% endfor %}
|
if |
|
ifchanged |
{% ifchanged %} {% endifchanged %}
|
ife |
{% if %} {% else %} {% endif %}
|
ifelse |
{% if %} {% else %} {% endif %}
|
ifeq |
{% ifequal %} {% endifequal %}
|
ifequal |
{% ifequal %} {% endifequal %}
|
ifnotequal |
{% ifnotequal %} {% endifnotequal %}
|
inc |
|
include |
|
load |
|
now |
|
regroup |
|
spaceless |
{% spaceless %} {% endspaceless %}
|
ssi |
|
static |
|
templatetag |
|
url |
|
verbatim |
{% verbatim %} {% endverbatim %}
|
widthratio |
|
with |
{% with as %} {% endwith %}
|
trans |
|
blocktrans |
{% blocktrans with as %} {% endblocktrans %}
|
Non-official snippets for templates
super |
|
extrahead |
{% block extrahead %}{% endblock extrahead %}
|
extrastyle |
{% block extrastyle %}{% endblock extrastyle %}
|
var |
|
tag |
|
staticu |
|
media |
|
Snippets for Django model fields
mauto |
|
mbigint |
models.BigIntegerField()
|
mbool |
|
mchar |
models.CommaSeparatedIntegerField()
|
mdate |
|
mdatetime |
models.DateTimeField()
|
mdecimal |
|
mduration |
models.DurationField()
|
memail |
|
mfile |
|
mfilepath |
models.FilePathField()
|
mfloat |
|
mimg |
|
mint |
|
mip |
models.IPAddressField()
|
mnullbool |
models.NullBooleanField()
|
mphone |
models.PhoneNumberField()
|
mposint |
models.PositiveIntegerField()
|
mpossmallint |
models.PositiveSmallIntegerField()
|
mslug |
|
msmallint |
models.SmallIntegerFiled()
|
mtext |
|
mtime |
|
murl |
|
musstate |
|
mxml |
|
fk |
|
m2m |
models.ManyToManyField()
|
o2o |
models.OneToOneField()
|
|
|
Snippets for Django form fields
fchar |
|
fchoice |
|
fcombo |
|
fdate |
|
fdatetime |
|
fdecimal |
|
fduration |
forms.DurationField()
|
femail |
|
ffile |
|
ffilepath |
forms.FilePathField()
|
ffloat |
|
fimg |
|
fint |
|
fip |
forms.IPAddressField()
|
fmochoice |
forms.ModelChoiceField()
|
fmomuchoice |
forms.ModelMultipleChoiceField()
|
fmuchoice |
forms.MultipleChoiceField()
|
fmuval |
forms.MultipleValueField()
|
fnullbool |
forms.NullBooleanField()
|
fregex |
|
fslug |
|
fsdatetime |
forms.SplitDateTime()
|
ftime |
|
ftchoice |
forms.TypedChoiceField()
|
ftmuchoice |
forms.TypedMultipleChoiceField()
|
furl |
|
Snippets for Django Models
Model |
|
Model_full |
Full Model Class(with TODOs)
|
Snippets for Django Views
view |
|
createview |
|
updateview |
|
deleteview |
|
detailview |
|
listview |
|
templateview |
|
adminview |
|
tabularinline |
|
stackedinline |
|
dispatch |
|
get_context_data |
get_context_data method for CBVs
|
Snippets for Python
init |
__init__(self, args, *kwargs)
|
pdb |
import pdb ; pdb.set_trace()
|
ipdb |
import ipdb ; ipdb.set_trace()
|
npdb |
from nose.tools import set_trace; set_trace()
|
traceback |
import traceback; traceback.print_exc();
|
utfc |
|
|
Created By
retrofrikis.com
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets