Merge pull request #599 from carlitux/master
Python/Python: Django snippets
This commit is contained in:
commit
464aeae09b
@ -1,238 +1,361 @@
|
|||||||
priority -50
|
priority -50
|
||||||
|
|
||||||
# Generic Tags
|
# This files will define django snippets from sublime text djaneiro
|
||||||
snippet %
|
# FORMS SNIPPETS
|
||||||
{% ${1} %}${2}
|
|
||||||
|
snippet form "Form" b
|
||||||
|
class ${1:FORMNAME}(forms.Form):
|
||||||
|
|
||||||
|
${2:# TODO: Define form fields here}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet %%
|
snippet modelform "ModelForm" b
|
||||||
{% ${1:tag_name} %}
|
class ${1:MODELNAME}Form(forms.ModelForm):
|
||||||
${2}
|
|
||||||
{% end$1 %}
|
class Meta:
|
||||||
|
model = $1
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet {
|
snippet fbool "BooleanField" b
|
||||||
{{ ${1} }}${2}
|
${1:FIELDNAME} = forms.BooleanField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Template Tags
|
snippet fchar "CharField" b
|
||||||
|
${1:FIELDNAME} = forms.CharField($2)
|
||||||
snippet autoescape
|
|
||||||
{% autoescape ${1:off} %}
|
|
||||||
${2}
|
|
||||||
{% endautoescape %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet block
|
snippet fchoice "ChoiceField" b
|
||||||
{% block ${1} %}
|
${1:FIELDNAME} = forms.ChoiceField($2)
|
||||||
${2}
|
|
||||||
{% endblock $1 %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet #
|
snippet fcombo "ComboField" b
|
||||||
{# ${1:comment} #}
|
${1:FIELDNAME} = forms.ComboField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet comment
|
snippet fdate "DateField" b
|
||||||
{% comment %}
|
${1:FIELDNAME} = forms.DateField($2)
|
||||||
${1}
|
|
||||||
{% endcomment %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cycle
|
snippet fdatetime "DateTimeField" b
|
||||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
${1:FIELDNAME} = forms.DateTimeField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet debug
|
snippet fdecimal "DecimalField" b
|
||||||
{% debug %}
|
${1:FIELDNAME} = forms.DecimalField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet extends
|
snippet fmail "EmailField" b
|
||||||
{% extends "${1:base.html}" %}
|
${1:FIELDNAME} = forms.EmailField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet filter
|
snippet ffile "FileField" b
|
||||||
{% filter ${1} %}
|
${1:FIELDNAME} = forms.FileField($2)
|
||||||
${2}
|
|
||||||
{% endfilter %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet firstof
|
snippet ffilepath "FilePathField" b
|
||||||
{% firstof ${1} %}
|
${1:FIELDNAME} = forms.FilePathField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet for
|
snippet ffloat "FloatField" b
|
||||||
{% for ${1} in ${2} %}
|
${1:FIELDNAME} = forms.FloatField($2)
|
||||||
${3}
|
|
||||||
{% endfor %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet empty
|
snippet fip "IPAddressField" b
|
||||||
{% empty %}
|
${1:FIELDNAME} = forms.IPAddressField($2)
|
||||||
${1}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if
|
snippet fimg "ImageField" b
|
||||||
{% if ${1} %}
|
${1:FIELDNAME} = forms.ImageField($2)
|
||||||
${2}
|
|
||||||
{% endif %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet else
|
snippet fint "IntegerField" b
|
||||||
{% else %}
|
${1:FIELDNAME} = forms.IntegerField($2)
|
||||||
${1}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifchanged
|
snippet fmochoice "ModelChoiceField" b
|
||||||
{% ifchanged %}${1}{% endifchanged %}
|
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifequal
|
snippet fmomuchoice "ModelMultipleChoiceField" b
|
||||||
{% ifequal ${1} ${2} %}
|
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
||||||
${3}
|
|
||||||
{% endifequal %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ifnotequal
|
snippet fmuval "MultiValueField" b
|
||||||
{% ifnotequal ${1} ${2} %}
|
${1:FIELDNAME} = forms.MultiValueField($2)
|
||||||
${3}
|
|
||||||
{% endifnotequal %}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet include
|
snippet fmuchoice "MultipleChoiceField" b
|
||||||
{% include "${1}" %}
|
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet load
|
snippet fnullbool "NullBooleanField" b
|
||||||
{% load ${1} %}
|
${1:FIELDNAME} = forms.NullBooleanField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet now
|
snippet freg "RegexField" b
|
||||||
{% now "${1:jS F Y H:i}" %}
|
${1:FIELDNAME} = forms.RegexField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet regroup
|
snippet fslug "SlugField" b
|
||||||
{% regroup ${1} by ${2} as ${3} %}
|
${1:FIELDNAME} = forms.SlugField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet spaceless
|
snippet fsdatetime "SplitDateTimeField" b
|
||||||
{% spaceless %}${1}{% endspaceless %}
|
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ssi
|
snippet ftime "TimeField" b
|
||||||
{% ssi ${1} %}
|
${1:FIELDNAME} = forms.TimeField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet trans
|
snippet ftchoice "TypedChoiceField" b
|
||||||
{% trans "${1:string}" %}
|
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet url
|
snippet ftmuchoice "TypedMultipleChoiceField" b
|
||||||
{% url ${1} as ${2} %}
|
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet widthratio
|
snippet furl "URLField" b
|
||||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
${1:FIELDNAME} = forms.URLField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet with
|
# MODELS SNIPPETS
|
||||||
{% with ${1} as ${2} %}
|
|
||||||
|
snippet model "Model" b
|
||||||
|
class ${1:MODELNAME}(models.Model):
|
||||||
|
${0}
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "$1"
|
||||||
|
verbose_name_plural = "$1s"
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return super($1, self).__str__()
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# Template Filters
|
snippet modelfull "Model" b
|
||||||
|
class ${1:MODELNAME}(models.Model):
|
||||||
|
${2:# TODO: Define fields here}
|
||||||
|
|
||||||
# Note: Since SnipMate can't determine which template filter you are
|
class Meta:
|
||||||
# expanding without the "|" character, these do not add the "|"
|
verbose_name = "$1"
|
||||||
# character. These save a few keystrokes still.
|
verbose_name_plural = "$1s"
|
||||||
|
|
||||||
# Note: Template tags that take no arguments are not implemented.
|
def __str__(self):
|
||||||
|
return super($1, self).__str__()
|
||||||
|
|
||||||
|
def save(self):
|
||||||
|
return super($1, self).save()
|
||||||
|
|
||||||
|
@models.permalink
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return ('')
|
||||||
|
|
||||||
|
${3:# TODO: Define custom methods here}
|
||||||
|
|
||||||
snippet add
|
|
||||||
add:"${1}"
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet center
|
snippet mauto "AutoField" b
|
||||||
center:"${1}"
|
${1:FIELDNAME} = models.AutoField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cut
|
snippet mbigint "BigIntegerField" b
|
||||||
cut:"${1}"
|
${1:FIELDNAME} = models.BigIntegerField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet date
|
snippet mbool "BooleanField" b
|
||||||
date:"${1}"
|
${1:FIELDNAME} = models.BooleanField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet default
|
snippet mchar "CharField" b
|
||||||
default:"${1}"
|
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet defaultifnone
|
snippet mcoseint "CommaSeparatedIntegerField" b
|
||||||
default_if_none:"${1}"
|
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet dictsort
|
snippet mdate "DateField" b
|
||||||
dictsort:"${1}"
|
${1:FIELDNAME} = models.DateField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet dictsortrev
|
snippet mdatetime "DateTimeField" b
|
||||||
dictsortreversed:"${1}"
|
${1:FIELDNAME} = models.DateTimeField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet divisibleby
|
snippet mdecimal "DecimalField" b
|
||||||
divisibleby:"${1}"
|
${1:FIELDNAME} = models.DateTimeField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet floatformat
|
snippet memail "EmailField" b
|
||||||
floatformat:"${1}"
|
${1:FIELDNAME} = models.EmailField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet getdigit
|
snippet mfile "FileField" b
|
||||||
get_digit:"${1}"
|
${1:FIELDNAME} = models.FileField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet join
|
snippet mfilepath "FilePathField" b
|
||||||
join:"${1}"
|
${1:FIELDNAME} = models.FilePathField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet lengthis
|
snippet mfloat "FloatField" b
|
||||||
length_is:"${1}"
|
${1:FIELDNAME} = models.FloatField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pluralize
|
snippet fk "ForeignKey" b
|
||||||
pluralize:"${1}"
|
${1:FIELDNAME} = models.ForeignKey($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet removetags
|
snippet mip "IPAddressField" b
|
||||||
removetags:"${1}"
|
${1:FIELDNAME} = models.IPAddressField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet slice
|
snippet mimg "ImageField" b
|
||||||
slice:"${1}"
|
${1:FIELDNAME} = models.ImageField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet stringformat
|
snippet mint "IntegerField" b
|
||||||
stringformat:"${1}"
|
${1:FIELDNAME} = models.IntegerField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet time
|
snippet m2m "ManyToManyField" b
|
||||||
time:"${1}"
|
${1:FIELDNAME} = models.ManyToManyField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet truncatewords
|
snippet mnullbool "NullBooleanField" b
|
||||||
truncatewords:${1}
|
${1:FIELDNAME} = models.NullBooleanField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet truncatewordshtml
|
snippet o2o "OneToOneField" b
|
||||||
truncatewords_html:${1}
|
${1:FIELDNAME} = models.OneToOneField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet urlizetrunc
|
snippet mphone "PhoneNumberField" b
|
||||||
urlizetrunc:${1}
|
${1:FIELDNAME} = models.PhoneNumberField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wordwrap
|
snippet mposint "PositiveIntegerField" b
|
||||||
wordwrap:${1}
|
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
snippet mpossmallint "PositiveSmallIntegerField" b
|
||||||
|
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mslug "SlugField" b
|
||||||
|
${1:FIELDNAME} = models.SlugField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet msmallint "SmallIntegerField" b
|
||||||
|
${1:FIELDNAME} = models.SmallIntegerField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mtext "TextField" b
|
||||||
|
${1:FIELDNAME} = models.TextField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mtime "TimeField" b
|
||||||
|
${1:FIELDNAME} = models.TimeField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet murl "URLField" b
|
||||||
|
${1:FIELDNAME} = models.URLField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet musstate "USStateField" b
|
||||||
|
${1:FIELDNAME} = models.USStateField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mxml "XMLField" b
|
||||||
|
${1:FIELDNAME} = models.XMLField($2)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# VIEWS SNIPPETS
|
||||||
|
|
||||||
|
snippet adminview "Model Admin View" b
|
||||||
|
class ${1}Admin(admin.ModelAdmin):
|
||||||
|
'''
|
||||||
|
Admin View for ${1}
|
||||||
|
'''
|
||||||
|
list_display = ('${2}',)
|
||||||
|
list_filter = ('${3}',)
|
||||||
|
inlines = [
|
||||||
|
${4}Inline,
|
||||||
|
]
|
||||||
|
raw_id_fields = ('${5}',)
|
||||||
|
readonly_fields = ('${6}',)
|
||||||
|
search_fields = ['${7}']
|
||||||
|
admin.site.register(${1}, ${1}Admin)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet createview "Generic Create View" b
|
||||||
|
class ${1:MODEL_NAME}CreateView(CreateView):
|
||||||
|
model = ${1:MODEL_NAME}
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet deleteview "Generic Delete View" b
|
||||||
|
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
||||||
|
model = ${1:MODEL_NAME}
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet detailview "Generic Detail View" b
|
||||||
|
class ${1:MODEL_NAME}DetailView(DetailView):
|
||||||
|
model = ${1:MODEL_NAME}
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet listview "Generic List View" b
|
||||||
|
class ${1:MODEL_NAME}ListView(ListView):
|
||||||
|
model = ${1:MODEL_NAME}
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet stackedinline "Stacked Inline" b
|
||||||
|
class ${1}Inline(admin.StackedInline):
|
||||||
|
'''
|
||||||
|
Stacked Inline View for ${1}
|
||||||
|
'''
|
||||||
|
model = ${2:${1}}
|
||||||
|
min_num = ${3:3}
|
||||||
|
max_num = ${4:20}
|
||||||
|
extra = ${5:1}
|
||||||
|
raw_id_fields = (${6},)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet tabularinline "Tabular Inline" b
|
||||||
|
class ${1}Inline(admin.TabularInline):
|
||||||
|
'''
|
||||||
|
Tabular Inline View for ${1}
|
||||||
|
'''
|
||||||
|
model = ${2:${1}}
|
||||||
|
min_num = ${3:3}
|
||||||
|
max_num = ${4:20}
|
||||||
|
extra = ${5:1}
|
||||||
|
raw_id_fields = (${6},)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet templateview "Generic Template View" b
|
||||||
|
class ${1:CLASS_NAME}(TemplateView):
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet updateview "Generic Update View" b
|
||||||
|
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
||||||
|
model = ${1:MODEL_NAME}
|
||||||
|
template_name = "${2:TEMPLATE_NAME}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet dispatch "Dispatch View method" b
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet context "get_context_data view method" b
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
kwargs['extra_context'] = ${1:'New Value'}
|
||||||
|
return super(${2:CLASS_NAME}, self).get_context_data(**kwargs)
|
||||||
|
endsnippet
|
||||||
|
@ -1,3 +1,299 @@
|
|||||||
priority -50
|
priority -50
|
||||||
|
|
||||||
extends html, django
|
extends html
|
||||||
|
|
||||||
|
# Generic Tags
|
||||||
|
snippet % "" bi
|
||||||
|
{% ${1} %}${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet %% "" bi
|
||||||
|
{% ${1:tag_name} %}
|
||||||
|
${2}
|
||||||
|
{% end$1 %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet { "" bi
|
||||||
|
{{ ${1} }}${2}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Template Tags
|
||||||
|
|
||||||
|
snippet autoescape "" bi
|
||||||
|
{% autoescape ${1:off} %}
|
||||||
|
${2}
|
||||||
|
{% endautoescape %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet block "" bi
|
||||||
|
{% block ${1} %}
|
||||||
|
${2}
|
||||||
|
{% endblock $1 %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet # "" bi
|
||||||
|
{# ${1:comment} #}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet comment "" bi
|
||||||
|
{% comment %}
|
||||||
|
${1}
|
||||||
|
{% endcomment %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cycle "" bi
|
||||||
|
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet debug "" bi
|
||||||
|
{% debug %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet extends "" bi
|
||||||
|
{% extends "${1:base.html}" %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet filter "" bi
|
||||||
|
{% filter ${1} %}
|
||||||
|
${2}
|
||||||
|
{% endfilter %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet firstof "" bi
|
||||||
|
{% firstof ${1} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet for "" bi
|
||||||
|
{% for ${1} in ${2} %}
|
||||||
|
${3}
|
||||||
|
{% endfor %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet empty "" bi
|
||||||
|
{% empty %}
|
||||||
|
${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet if "" bi
|
||||||
|
{% if ${1} %}
|
||||||
|
${2}
|
||||||
|
{% endif %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet iif "" bi
|
||||||
|
{% if ${1} %}${2}{% endif %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ielse "" bi
|
||||||
|
{% else %}${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet else "" bi
|
||||||
|
{% else %}
|
||||||
|
${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ielif "" bi
|
||||||
|
{% elif %}${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet elif "" bi
|
||||||
|
{% elif %}
|
||||||
|
${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ifchanged "" bi
|
||||||
|
{% ifchanged %}${1}{% endifchanged %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ifequal "" bi
|
||||||
|
{% ifequal ${1} ${2} %}
|
||||||
|
${3}
|
||||||
|
{% endifequal %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ifnotequal "" bi
|
||||||
|
{% ifnotequal ${1} ${2} %}
|
||||||
|
${3}
|
||||||
|
{% endifnotequal %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet include "" bi
|
||||||
|
{% include "${1}" %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet load "" bi
|
||||||
|
{% load ${1} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet now "" bi
|
||||||
|
{% now "${1:jS F Y H:i}" %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet regroup "" bi
|
||||||
|
{% regroup ${1} by ${2} as ${3} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet spaceless "" bi
|
||||||
|
{% spaceless %}${1}{% endspaceless %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ssi "" bi
|
||||||
|
{% ssi ${1} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet trans "" bi
|
||||||
|
{% trans "${1:string}" %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet url "" bi
|
||||||
|
{% url ${1} as ${2} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet widthratio "" bi
|
||||||
|
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet with "" bi
|
||||||
|
{% with ${1} as ${2} %}
|
||||||
|
${VISUAL}
|
||||||
|
{% endwith %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet verbatim "" bi
|
||||||
|
{% verbatim %}
|
||||||
|
${VISUAL}
|
||||||
|
{% endverbatim %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet super "" bi
|
||||||
|
{{ block.super }}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet staticu "" bi
|
||||||
|
{{ STATIC_URL }}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet static "" bi
|
||||||
|
{% static "${VISUAL}" %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet mediau "" bi
|
||||||
|
{{ MEDIA_URL }}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet iblock "" bi
|
||||||
|
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet csfr "" bi
|
||||||
|
{% csrf_token %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet blocktrans "" bi
|
||||||
|
{% blocktrans %}
|
||||||
|
${VISUAL}
|
||||||
|
{% endblocktrans %}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet lorem "" bi
|
||||||
|
{% lorem ${1} %}
|
||||||
|
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 "" bi
|
||||||
|
add:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet center "" bi
|
||||||
|
center:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet cut "" bi
|
||||||
|
cut:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet date "" bi
|
||||||
|
date:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet default "" bi
|
||||||
|
default:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet defaultifnone "" bi
|
||||||
|
default_if_none:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet dictsort "" bi
|
||||||
|
dictsort:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet dictsortrev "" bi
|
||||||
|
dictsortreversed:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet divisibleby "" bi
|
||||||
|
divisibleby:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet floatformat "" bi
|
||||||
|
floatformat:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet getdigit "" bi
|
||||||
|
get_digit:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet join "" bi
|
||||||
|
join:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet lengthis "" bi
|
||||||
|
length_is:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pluralize "" bi
|
||||||
|
pluralize:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet removetags "" bi
|
||||||
|
removetags:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet slice "" bi
|
||||||
|
slice:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet stringformat "" bi
|
||||||
|
stringformat:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet time "" bi
|
||||||
|
time:"${1}"
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet truncatewords "" bi
|
||||||
|
truncatewords:${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet truncatewordshtml "" bi
|
||||||
|
truncatewords_html:${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet urlizetrunc "" bi
|
||||||
|
urlizetrunc:${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet wordwrap "" bi
|
||||||
|
wordwrap:${1}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# vim:ft=snippets:
|
||||||
|
Loading…
Reference in New Issue
Block a user