vim-snippets/UltiSnips/django.snippets

370 lines
5.7 KiB
Plaintext
Raw Normal View History

priority -50
2015-07-10 16:45:53 -04:00
# This files will define django snippets from sublime text djaneiro
###########################################################################
# FORMS SNIPPETS #
###########################################################################
snippet form
class ${1:FORMNAME}(forms.Form):
${2:# TODO: Define form fields here}
endsnippet
snippet modelform
class ${1:MODELNAME}Form(forms.ModelForm):
class Meta:
model = $1
endsnippet
snippet fbool
${1:FIELDNAME} = forms.BooleanField($2)
endsnippet
snippet fchar
${1:FIELDNAME} = forms.CharField($2)
endsnippet
snippet fchoice
${1:FIELDNAME} = forms.ChoiceField($2)
endsnippet
snippet fcombo
${1:FIELDNAME} = forms.ComboField($2)
endsnippet
snippet fdate
${1:FIELDNAME} = forms.DateField($2)
endsnippet
snippet fdatetime
${1:FIELDNAME} = forms.DateTimeField($2)
endsnippet
snippet fdecimal
${1:FIELDNAME} = forms.DecimalField($2)
endsnippet
snippet fmail
${1:FIELDNAME} = forms.EmailField($2)
endsnippet
snippet ffile
${1:FIELDNAME} = forms.FileField($2)
endsnippet
snippet ffilepath
${1:FIELDNAME} = forms.FilePathField($2)
endsnippet
snippet ffloat
${1:FIELDNAME} = forms.FloatField($2)
endsnippet
snippet fip
${1:FIELDNAME} = forms.IPAddressField($2)
endsnippet
snippet fimg
${1:FIELDNAME} = forms.ImageField($2)
endsnippet
snippet fint
${1:FIELDNAME} = forms.IntegerField($2)
endsnippet
snippet fmochoice
${1:FIELDNAME} = forms.ModelChoiceField($2)
endsnippet
snippet fmomuchoice
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
endsnippet
snippet fmuval
${1:FIELDNAME} = forms.MultiValueField($2)
endsnippet
snippet fmuchoice
${1:FIELDNAME} = forms.MultipleChoiceField($2)
endsnippet
snippet fnullbool
${1:FIELDNAME} = forms.NullBooleanField($2)
endsnippet
snippet freg
${1:FIELDNAME} = forms.RegexField($2)
endsnippet
snippet fslug
${1:FIELDNAME} = forms.SlugField($2)
endsnippet
snippet fsdatetime
${1:FIELDNAME} = forms.SplitDateTimeField($2)
endsnippet
snippet ftime
${1:FIELDNAME} = forms.TimeField($2)
endsnippet
snippet ftchoice
${1:FIELDNAME} = forms.TypedChoiceField($2)
endsnippet
snippet ftmuchoice
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
endsnippet
snippet furl
${1:FIELDNAME} = forms.URLField($2)
endsnippet
#########################################################################################
# Models
#########################################################################################
#########################################################################################
# Views
#########################################################################################
#########################################################################################
# Forms
#########################################################################################
# Generic Tags
snippet %
{% ${1} %}${2}
endsnippet
snippet %%
{% ${1:tag_name} %}
${2}
{% end$1 %}
endsnippet
snippet {
{{ ${1} }}${2}
endsnippet
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${2}
{% endautoescape %}
endsnippet
snippet block
{% block ${1} %}
${2}
{% endblock $1 %}
endsnippet
snippet #
{# ${1:comment} #}
endsnippet
snippet comment
{% comment %}
${1}
{% endcomment %}
endsnippet
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
endsnippet
snippet debug
{% debug %}
endsnippet
snippet extends
{% extends "${1:base.html}" %}
endsnippet
snippet filter
{% filter ${1} %}
${2}
{% endfilter %}
endsnippet
snippet firstof
{% firstof ${1} %}
endsnippet
snippet for
{% for ${1} in ${2} %}
${3}
{% endfor %}
endsnippet
snippet empty
{% empty %}
${1}
endsnippet
snippet if
{% if ${1} %}
${2}
{% endif %}
endsnippet
snippet else
{% else %}
${1}
endsnippet
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
endsnippet
snippet ifequal
{% ifequal ${1} ${2} %}
${3}
{% endifequal %}
endsnippet
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${3}
{% endifnotequal %}
endsnippet
snippet include
{% include "${1}" %}
endsnippet
snippet load
{% load ${1} %}
endsnippet
snippet now
{% now "${1:jS F Y H:i}" %}
endsnippet
snippet regroup
{% regroup ${1} by ${2} as ${3} %}
endsnippet
snippet spaceless
{% spaceless %}${1}{% endspaceless %}
endsnippet
snippet ssi
{% ssi ${1} %}
endsnippet
snippet trans
{% trans "${1:string}" %}
endsnippet
snippet url
{% url ${1} as ${2} %}
endsnippet
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
endsnippet
snippet with
{% with ${1} as ${2} %}
endsnippet
# Template Filters
# Note: Since SnipMate can't determine which template filter you are
# expanding without the "|" character, these do not add the "|"
# character. These save a few keystrokes still.
# Note: Template tags that take no arguments are not implemented.
snippet add
add:"${1}"
endsnippet
snippet center
center:"${1}"
endsnippet
snippet cut
cut:"${1}"
endsnippet
snippet date
date:"${1}"
endsnippet
snippet default
default:"${1}"
endsnippet
snippet defaultifnone
default_if_none:"${1}"
endsnippet
snippet dictsort
dictsort:"${1}"
endsnippet
snippet dictsortrev
dictsortreversed:"${1}"
endsnippet
snippet divisibleby
divisibleby:"${1}"
endsnippet
snippet floatformat
floatformat:"${1}"
endsnippet
snippet getdigit
get_digit:"${1}"
endsnippet
snippet join
join:"${1}"
endsnippet
snippet lengthis
length_is:"${1}"
endsnippet
snippet pluralize
pluralize:"${1}"
endsnippet
snippet removetags
removetags:"${1}"
endsnippet
snippet slice
slice:"${1}"
endsnippet
snippet stringformat
stringformat:"${1}"
endsnippet
snippet time
time:"${1}"
endsnippet
snippet truncatewords
truncatewords:${1}
endsnippet
snippet truncatewordshtml
truncatewords_html:${1}
endsnippet
snippet urlizetrunc
urlizetrunc:${1}
endsnippet
snippet wordwrap
wordwrap:${1}
endsnippet
# vim:ft=snippets: