Start migration from djaneiro

This commit is contained in:
Luis Carlos Cruz Carballo 2015-07-10 19:43:24 -04:00
parent dfa8c37d54
commit 348236ab9e
2 changed files with 426 additions and 190 deletions

View File

@ -5,365 +5,364 @@ priority -50
###########################################################################
# FORMS SNIPPETS #
###########################################################################
snippet form
snippet form "Form"
class ${1:FORMNAME}(forms.Form):
${2:# TODO: Define form fields here}
endsnippet
snippet modelform
snippet modelform "ModelForm"
class ${1:MODELNAME}Form(forms.ModelForm):
class Meta:
model = $1
endsnippet
snippet fbool
snippet fbool "BooleanField (fbool)"
${1:FIELDNAME} = forms.BooleanField($2)
endsnippet
snippet fchar
snippet fchar "CharField (fchar)"
${1:FIELDNAME} = forms.CharField($2)
endsnippet
snippet fchoice
snippet fchoice "ChoiceField (fchoice)"
${1:FIELDNAME} = forms.ChoiceField($2)
endsnippet
snippet fcombo
snippet fcombo "ComboField (fcombo)"
${1:FIELDNAME} = forms.ComboField($2)
endsnippet
snippet fdate
snippet fdate "DateField (fdate)"
${1:FIELDNAME} = forms.DateField($2)
endsnippet
snippet fdatetime
snippet fdatetime "DateTimeField (fdatetime)"
${1:FIELDNAME} = forms.DateTimeField($2)
endsnippet
snippet fdecimal
snippet fdecimal "DecimalField (fdecimal)"
${1:FIELDNAME} = forms.DecimalField($2)
endsnippet
snippet fmail
snippet fmail "EmailField (femail)"
${1:FIELDNAME} = forms.EmailField($2)
endsnippet
snippet ffile
snippet ffile "FileField (ffile)"
${1:FIELDNAME} = forms.FileField($2)
endsnippet
snippet ffilepath
snippet ffilepath "FilePathField (ffilepath)"
${1:FIELDNAME} = forms.FilePathField($2)
endsnippet
snippet ffloat
snippet ffloat "FloatField (ffloat)"
${1:FIELDNAME} = forms.FloatField($2)
endsnippet
snippet fip
snippet fip "IPAddressField (fip)"
${1:FIELDNAME} = forms.IPAddressField($2)
endsnippet
snippet fimg
snippet fimg "ImageField (fimg)"
${1:FIELDNAME} = forms.ImageField($2)
endsnippet
snippet fint
snippet fint "IntegerField (fint)"
${1:FIELDNAME} = forms.IntegerField($2)
endsnippet
snippet fmochoice
snippet fmochoice "ModelChoiceField (fmochoice)"
${1:FIELDNAME} = forms.ModelChoiceField($2)
endsnippet
snippet fmomuchoice
snippet fmomuchoice "ModelMultipleChoiceField (fmomuchoice)"
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
endsnippet
snippet fmuval
snippet fmuval "MultiValueField (fmuval)"
${1:FIELDNAME} = forms.MultiValueField($2)
endsnippet
snippet fmuchoice
snippet fmuchoice "MultipleChoiceField (fmuchoice)"
${1:FIELDNAME} = forms.MultipleChoiceField($2)
endsnippet
snippet fnullbool
snippet fnullbool "NullBooleanField (fnullbool)"
${1:FIELDNAME} = forms.NullBooleanField($2)
endsnippet
snippet freg
snippet freg "RegexField (fregex)"
${1:FIELDNAME} = forms.RegexField($2)
endsnippet
snippet fslug
snippet fslug "SlugField (fslug)"
${1:FIELDNAME} = forms.SlugField($2)
endsnippet
snippet fsdatetime
snippet fsdatetime "SplitDateTimeField (fsdatetime)"
${1:FIELDNAME} = forms.SplitDateTimeField($2)
endsnippet
snippet ftime
snippet ftime "TimeField (ftime)"
${1:FIELDNAME} = forms.TimeField($2)
endsnippet
snippet ftchoice
snippet ftchoice "TypedChoiceField (ftchoice)"
${1:FIELDNAME} = forms.TypedChoiceField($2)
endsnippet
snippet ftmuchoice
snippet ftmuchoice "TypedMultipleChoiceField (ftmuchoice)"
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
endsnippet
snippet furl
snippet furl "URLField (furl)"
${1:FIELDNAME} = forms.URLField($2)
endsnippet
#########################################################################################
# Models
#########################################################################################
###########################################################################
# MODELS SNIPPETS #
###########################################################################
#########################################################################################
# Views
#########################################################################################
snippet model "Model"
class ${1:MODELNAME}(models.Model):
class Meta:
verbose_name = "$1"
verbose_name_plural = "$1s"
def __str__(self):
pass
#########################################################################################
# Forms
#########################################################################################
# Generic Tags
snippet %
{% ${1} %}${2}
endsnippet
snippet %%
{% ${1:tag_name} %}
${2}
{% end$1 %}
snippet modelfull "Model (full)"
class ${1:MODELNAME}(models.Model):
${2:# TODO: Define fields here}
class Meta:
verbose_name = "$1"
verbose_name_plural = "$1s"
def __str__(self):
pass
def save(self):
pass
@models.permalink
def get_absolute_url(self):
return ('')
${3:# TODO: Define custom methods here}
endsnippet
snippet {
{{ ${1} }}${2}
snippet mauto "AutoField (mauto)"
${1:FIELDNAME} = models.AutoField($2)
endsnippet
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${2}
{% endautoescape %}
snippet mbigint "BigIntegerField (mbigint)"
${1:FIELDNAME} = models.BigIntegerField($2)
endsnippet
snippet block
{% block ${1} %}
${2}
{% endblock $1 %}
snippet mbool "BooleanField (mbool)"
${1:FIELDNAME} = models.BooleanField($2)
endsnippet
snippet #
{# ${1:comment} #}
snippet mchar "CharField (mchar)"
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
endsnippet
snippet comment
{% comment %}
${1}
{% endcomment %}
snippet mcoseint "CommaSeparatedIntegerField (mcoseint)"
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
endsnippet
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet mdate "DateField (mdate)"
${1:FIELDNAME} = models.DateField($2)
endsnippet
snippet debug
{% debug %}
snippet mdatetime "DateTimeField (mdatetime)"
${1:FIELDNAME} = models.DateTimeField($2)
endsnippet
snippet extends
{% extends "${1:base.html}" %}
snippet mdecimal "DecimalField (mdecimal)"
${1:FIELDNAME} = models.DateTimeField($2)
endsnippet
snippet filter
{% filter ${1} %}
${2}
{% endfilter %}
snippet memail "EmailField (memail)"
${1:FIELDNAME} = models.EmailField($2)
endsnippet
snippet firstof
{% firstof ${1} %}
snippet mfile "FileField (mfile)"
${1:FIELDNAME} = models.FileField($2)
endsnippet
snippet for
{% for ${1} in ${2} %}
${3}
{% endfor %}
snippet mfilepath "FilePathField (mfilepath)"
${1:FIELDNAME} = models.FilePathField($2)
endsnippet
snippet empty
{% empty %}
${1}
snippet mfloat "FloatField (mfloat)"
${1:FIELDNAME} = models.FloatField($2)
endsnippet
snippet if
{% if ${1} %}
${2}
{% endif %}
snippet fk "ForeignKey (fk)"
${1:FIELDNAME} = models.ForeignKey($2)
endsnippet
snippet else
{% else %}
${1}
snippet mip "IPAddressField (mip)"
${1:FIELDNAME} = models.IPAddressField($2)
endsnippet
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet mimg "ImageField (mimg)"
${1:FIELDNAME} = models.ImageField($2)
endsnippet
snippet ifequal
{% ifequal ${1} ${2} %}
${3}
{% endifequal %}
snippet mint "IntegerField (mint)"
${1:FIELDNAME} = models.IntegerField($2)
endsnippet
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${3}
{% endifnotequal %}
snippet m2m "ManyToManyField (m2m)"
${1:FIELDNAME} = models.ManyToManyField($2)
endsnippet
snippet include
{% include "${1}" %}
snippet mnullbool "NullBooleanField (mnullbool)"
${1:FIELDNAME} = models.NullBooleanField($2)
endsnippet
snippet load
{% load ${1} %}
snippet o2o "OneToOneField (o2o)"
${1:FIELDNAME} = models.OneToOneField($2)
endsnippet
snippet now
{% now "${1:jS F Y H:i}" %}
snippet mphone "PhoneNumberField (mphone)"
${1:FIELDNAME} = models.PhoneNumberField($2)
endsnippet
snippet regroup
{% regroup ${1} by ${2} as ${3} %}
snippet mposint "PositiveIntegerField (mposint)"
${1:FIELDNAME} = models.PositiveIntegerField($2)
endsnippet
snippet spaceless
{% spaceless %}${1}{% endspaceless %}
snippet mpossmallint "PositiveSmallIntegerField (mpossmallint)"
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
endsnippet
snippet ssi
{% ssi ${1} %}
snippet mslug "SlugField (mslug)"
${1:FIELDNAME} = models.SlugField($2)
endsnippet
snippet trans
{% trans "${1:string}" %}
snippet msmallint "SmallIntegerField (msmallint)"
${1:FIELDNAME} = models.SmallIntegerField($2)
endsnippet
snippet url
{% url ${1} as ${2} %}
snippet mtext "TextField (mtext)"
${1:FIELDNAME} = models.TextField($2)
endsnippet
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
snippet mtime "TimeField (mtime)"
${1:FIELDNAME} = models.TimeField($2)
endsnippet
snippet with
{% with ${1} as ${2} %}
snippet murl "URLField (murl)"
${1:FIELDNAME} = models.URLField($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}"
snippet musstate "USStateField (musstate)"
${1:FIELDNAME} = models.USStateField($2)
endsnippet
snippet center
center:"${1}"
snippet mxml "XMLField (mxml)"
${1:FIELDNAME} = models.XMLField($2)
endsnippet
snippet cut
cut:"${1}"
###########################################################################
# VIEWS SNIPPETS #
###########################################################################
snippet adminview "Model Admin View"
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 date
date:"${1}"
snippet createview "Generic Create View"
class ${1:MODEL_NAME}CreateView(CreateView):
model = ${1:MODEL_NAME}
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet default
default:"${1}"
snippet deleteview "Generic Delete View"
class ${1:MODEL_NAME}DeleteView(DeleteView):
model = ${1:MODEL_NAME}
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet defaultifnone
default_if_none:"${1}"
snippet detailview "Generic Detail View"
class ${1:MODEL_NAME}DetailView(DetailView):
model = ${1:MODEL_NAME}
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet dictsort
dictsort:"${1}"
snippet listview "Generic List View"
class ${1:MODEL_NAME}ListView(ListView):
model = ${1:MODEL_NAME}
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet dictsortrev
dictsortreversed:"${1}"
snippet stackedinline "Stacked Inline"
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 divisibleby
divisibleby:"${1}"
snippet tabularinline "Tabular Inline"
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 floatformat
floatformat:"${1}"
snippet templateview "Generic Template View"
class ${1:CLASS_NAME}(TemplateView):
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet getdigit
get_digit:"${1}"
snippet updateview "Generic Update View"
class ${1:MODEL_NAME}UpdateView(UpdateView):
model = ${1:MODEL_NAME}
template_name = "${2:TEMPLATE_NAME}"
endsnippet
snippet join
join:"${1}"
snippet dispatch "Dispatch View method"
def dispatch(self, request, *args, **kwargs):
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
endsnippet
snippet lengthis
length_is:"${1}"
snippet context "get_context_data view method"
def get_context_data(self, **kwargs):
context = super(${1:CLASS_NAME}, self).get_context_data(**kwargs)
return context
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:

View File

@ -1,3 +1,240 @@
priority -50
extends html, django
extends html
# 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: