From dfa8c37d54ad2c8c96ddf7e68e9a41b696125952 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 16:45:53 -0400 Subject: [PATCH 01/15] Django forms snippets done --- UltiSnips/django.snippets | 131 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 9d6ce27..7d02f39 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -1,5 +1,136 @@ priority -50 +# 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} From 348236ab9e24247e90fcb465de5e0e70588400c0 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 19:43:24 -0400 Subject: [PATCH 02/15] Start migration from djaneiro --- UltiSnips/django.snippets | 377 +++++++++++++++++----------------- UltiSnips/htmldjango.snippets | 239 ++++++++++++++++++++- 2 files changed, 426 insertions(+), 190 deletions(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 7d02f39..6144e97 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -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: diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index 5836a2f..f77ad88 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -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: From d1f383ab5399ba03ea42ffcbc8393ad69cb7b9e0 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 20:02:33 -0400 Subject: [PATCH 03/15] Start migration from djaneiro --- UltiSnips/python.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index 3ee7d92..c02450a 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -1,5 +1,7 @@ priority -50 +extend django + ########################################################################### # TEXTMATE SNIPPETS # ########################################################################### From 0abbd8160b5957f4ce0291b9ebe513d56f6c5754 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 20:10:52 -0400 Subject: [PATCH 04/15] Start migration from djaneiro --- UltiSnips/python.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index c02450a..1b6391c 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -1,6 +1,6 @@ priority -50 -extend django +extends django ########################################################################### # TEXTMATE SNIPPETS # From 8b2e2c2bdfd39f3110be5da1f47e0a2a10f8fda4 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 21:20:39 -0400 Subject: [PATCH 05/15] Improve htmldjango --- UltiSnips/htmldjango.snippets | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index f77ad88..3c6bc59 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -80,11 +80,28 @@ snippet if {% endif %} endsnippet +snippet iif +{% if ${1} %}${2}{% endif %} +endsnippet + +snippet ielse +{% else %}${1} +endsnippet + snippet else {% else %} ${1} endsnippet +snippet ielif +{% elif %}${1} +endsnippet + +snippet elif +{% elif %} + ${1} +endsnippet + snippet ifchanged {% ifchanged %}${1}{% endifchanged %} endsnippet @@ -139,6 +156,48 @@ endsnippet snippet with {% with ${1} as ${2} %} + ${3:$VISUAL} +{% endwith %} +endsnippet + +snippet verbatim +{% verbatim %} + ${1:$VISUAL} +{% endverbatim %} +endsnippet + +snippet super +{{ block.super }} +endsnippet + +snippet staticu +{{ STATIC_URL }} +endsnippet + +snippet static +{% static "${1:$VISUAL}" %} +endsnippet + +snippet mediau +{{ MEDIA_URL }} +endsnippet + +snippet iblock +{% block ${1:blockname} %}${2:$VISUAL}{% endblock ${1:blockname} %} +endsnippet + +snippet csfr +{% csrf_token %} +endsnippet + +snippet blocktrans +{% blocktrans %} + ${1:$VISUAL} +{% endblocktrans %} +endsnippet + +snippet lorem +{% lorem ${1} %} endsnippet # Template Filters From a53a23b4cc32e833a9dd0c1d75dfc424beb4af60 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 22:31:01 -0400 Subject: [PATCH 06/15] To test attributes --- UltiSnips/django.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 6144e97..4c53090 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -366,3 +366,10 @@ def get_context_data(self, **kwargs): return context endsnippet +########################################################################### +# MODEL FIELDS SNIPPETS # +########################################################################### + +snippet null +null=${1:True} +endsnippet From b1063c08f4841fb4ea1b79f04175ad1e9b6c0272 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 22:37:56 -0400 Subject: [PATCH 07/15] To test attributes --- UltiSnips/django.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 4c53090..7d74cb2 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -370,6 +370,6 @@ endsnippet # MODEL FIELDS SNIPPETS # ########################################################################### -snippet null +snippet null w null=${1:True} endsnippet From 8e5178d2365b71b23bff16d3458289fc1feceebc Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 22:39:49 -0400 Subject: [PATCH 08/15] To test attributes --- UltiSnips/django.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 7d74cb2..4e45c21 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -370,6 +370,6 @@ endsnippet # MODEL FIELDS SNIPPETS # ########################################################################### -snippet null w +snippet null "null" w null=${1:True} endsnippet From c69f680c6dd9e417b37811d807be43216a3e731e Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 22:46:18 -0400 Subject: [PATCH 09/15] To test attributes --- UltiSnips/django.snippets | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 4e45c21..f8a69ef 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -8,14 +8,14 @@ priority -50 snippet form "Form" class ${1:FORMNAME}(forms.Form): - ${2:# TODO: Define form fields here} + ${2:# TODO: Define form fields here} endsnippet snippet modelform "ModelForm" class ${1:MODELNAME}Form(forms.ModelForm): - class Meta: - model = $1 + class Meta: + model = $1 endsnippet snippet fbool "BooleanField (fbool)" @@ -128,35 +128,35 @@ endsnippet snippet model "Model" class ${1:MODELNAME}(models.Model): + ${0} + class Meta: + verbose_name = "$1" + verbose_name_plural = "$1s" - class Meta: - verbose_name = "$1" - verbose_name_plural = "$1s" - - def __str__(self): - pass + def __str__(self): + pass endsnippet snippet modelfull "Model (full)" class ${1:MODELNAME}(models.Model): - ${2:# TODO: Define fields here} + ${2:# TODO: Define fields here} - class Meta: - verbose_name = "$1" - verbose_name_plural = "$1s" + class Meta: + verbose_name = "$1" + verbose_name_plural = "$1s" - def __str__(self): - pass + def __str__(self): + pass - def save(self): - pass + def save(self): + pass - @models.permalink - def get_absolute_url(self): - return ('') + @models.permalink + def get_absolute_url(self): + return ('') - ${3:# TODO: Define custom methods here} + ${3:# TODO: Define custom methods here} endsnippet @@ -370,6 +370,6 @@ endsnippet # MODEL FIELDS SNIPPETS # ########################################################################### -snippet null "null" w +snippet null "null" i null=${1:True} endsnippet From cf8b0ecad069cf1b7de710b03b84cf481c9423e5 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Fri, 10 Jul 2015 22:50:24 -0400 Subject: [PATCH 10/15] Ready for pull request --- UltiSnips/django.snippets | 8 -------- 1 file changed, 8 deletions(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index f8a69ef..838c127 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -365,11 +365,3 @@ def get_context_data(self, **kwargs): context = super(${1:CLASS_NAME}, self).get_context_data(**kwargs) return context endsnippet - -########################################################################### -# MODEL FIELDS SNIPPETS # -########################################################################### - -snippet null "null" i -null=${1:True} -endsnippet From f0a9a1e80b164e05f4b3d1eb6429c01a8f800a6e Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Sun, 2 Aug 2015 23:37:31 -0400 Subject: [PATCH 11/15] Add some options to test on templates --- UltiSnips/django.snippets | 238 +++++++++++++++++----------------- UltiSnips/htmldjango.snippets | 12 +- UltiSnips/python.snippets | 2 - 3 files changed, 122 insertions(+), 130 deletions(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 838c127..6271594 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -1,132 +1,128 @@ priority -50 # This files will define django snippets from sublime text djaneiro +# FORMS SNIPPETS -########################################################################### -# FORMS SNIPPETS # -########################################################################### -snippet form "Form" +snippet form "Form" b class ${1:FORMNAME}(forms.Form): ${2:# TODO: Define form fields here} endsnippet -snippet modelform "ModelForm" +snippet modelform "ModelForm" b class ${1:MODELNAME}Form(forms.ModelForm): class Meta: model = $1 endsnippet -snippet fbool "BooleanField (fbool)" +snippet fbool "BooleanField" b ${1:FIELDNAME} = forms.BooleanField($2) endsnippet -snippet fchar "CharField (fchar)" +snippet fchar "CharField" b ${1:FIELDNAME} = forms.CharField($2) endsnippet -snippet fchoice "ChoiceField (fchoice)" +snippet fchoice "ChoiceField" b ${1:FIELDNAME} = forms.ChoiceField($2) endsnippet -snippet fcombo "ComboField (fcombo)" +snippet fcombo "ComboField" b ${1:FIELDNAME} = forms.ComboField($2) endsnippet -snippet fdate "DateField (fdate)" +snippet fdate "DateField" b ${1:FIELDNAME} = forms.DateField($2) endsnippet -snippet fdatetime "DateTimeField (fdatetime)" +snippet fdatetime "DateTimeField" b ${1:FIELDNAME} = forms.DateTimeField($2) endsnippet -snippet fdecimal "DecimalField (fdecimal)" +snippet fdecimal "DecimalField" b ${1:FIELDNAME} = forms.DecimalField($2) endsnippet -snippet fmail "EmailField (femail)" +snippet fmail "EmailField" b ${1:FIELDNAME} = forms.EmailField($2) endsnippet -snippet ffile "FileField (ffile)" +snippet ffile "FileField" b ${1:FIELDNAME} = forms.FileField($2) endsnippet -snippet ffilepath "FilePathField (ffilepath)" +snippet ffilepath "FilePathField" b ${1:FIELDNAME} = forms.FilePathField($2) endsnippet -snippet ffloat "FloatField (ffloat)" +snippet ffloat "FloatField" b ${1:FIELDNAME} = forms.FloatField($2) endsnippet -snippet fip "IPAddressField (fip)" +snippet fip "IPAddressField" b ${1:FIELDNAME} = forms.IPAddressField($2) endsnippet -snippet fimg "ImageField (fimg)" +snippet fimg "ImageField" b ${1:FIELDNAME} = forms.ImageField($2) endsnippet -snippet fint "IntegerField (fint)" +snippet fint "IntegerField" b ${1:FIELDNAME} = forms.IntegerField($2) endsnippet -snippet fmochoice "ModelChoiceField (fmochoice)" +snippet fmochoice "ModelChoiceField" b ${1:FIELDNAME} = forms.ModelChoiceField($2) endsnippet -snippet fmomuchoice "ModelMultipleChoiceField (fmomuchoice)" +snippet fmomuchoice "ModelMultipleChoiceField" b ${1:FIELDNAME} = forms.ModelMultipleChoiceField($2) endsnippet -snippet fmuval "MultiValueField (fmuval)" +snippet fmuval "MultiValueField" b ${1:FIELDNAME} = forms.MultiValueField($2) endsnippet -snippet fmuchoice "MultipleChoiceField (fmuchoice)" +snippet fmuchoice "MultipleChoiceField" b ${1:FIELDNAME} = forms.MultipleChoiceField($2) endsnippet -snippet fnullbool "NullBooleanField (fnullbool)" +snippet fnullbool "NullBooleanField" b ${1:FIELDNAME} = forms.NullBooleanField($2) endsnippet -snippet freg "RegexField (fregex)" +snippet freg "RegexField" b ${1:FIELDNAME} = forms.RegexField($2) endsnippet -snippet fslug "SlugField (fslug)" +snippet fslug "SlugField" b ${1:FIELDNAME} = forms.SlugField($2) endsnippet -snippet fsdatetime "SplitDateTimeField (fsdatetime)" +snippet fsdatetime "SplitDateTimeField" b ${1:FIELDNAME} = forms.SplitDateTimeField($2) endsnippet -snippet ftime "TimeField (ftime)" +snippet ftime "TimeField" b ${1:FIELDNAME} = forms.TimeField($2) endsnippet -snippet ftchoice "TypedChoiceField (ftchoice)" +snippet ftchoice "TypedChoiceField" b ${1:FIELDNAME} = forms.TypedChoiceField($2) endsnippet -snippet ftmuchoice "TypedMultipleChoiceField (ftmuchoice)" +snippet ftmuchoice "TypedMultipleChoiceField" b ${1:FIELDNAME} = forms.TypedMultipleChoiceField($2) endsnippet -snippet furl "URLField (furl)" +snippet furl "URLField" b ${1:FIELDNAME} = forms.URLField($2) endsnippet -########################################################################### -# MODELS SNIPPETS # -########################################################################### +# MODELS SNIPPETS -snippet model "Model" +snippet model "Model" b class ${1:MODELNAME}(models.Model): ${0} class Meta: @@ -138,7 +134,7 @@ class ${1:MODELNAME}(models.Model): endsnippet -snippet modelfull "Model (full)" +snippet modelfull "Model" b class ${1:MODELNAME}(models.Model): ${2:# TODO: Define fields here} @@ -147,10 +143,10 @@ class ${1:MODELNAME}(models.Model): verbose_name_plural = "$1s" def __str__(self): - pass + return super($1, self).__str__() def save(self): - pass + return super($1, self).save() @models.permalink def get_absolute_url(self): @@ -160,208 +156,206 @@ class ${1:MODELNAME}(models.Model): endsnippet -snippet mauto "AutoField (mauto)" +snippet mauto "AutoField" b ${1:FIELDNAME} = models.AutoField($2) endsnippet -snippet mbigint "BigIntegerField (mbigint)" +snippet mbigint "BigIntegerField" b ${1:FIELDNAME} = models.BigIntegerField($2) endsnippet -snippet mbool "BooleanField (mbool)" +snippet mbool "BooleanField" b ${1:FIELDNAME} = models.BooleanField($2) endsnippet -snippet mchar "CharField (mchar)" +snippet mchar "CharField" b ${1:FIELDNAME} = models.CharField($2, max_length=${3:50}) endsnippet -snippet mcoseint "CommaSeparatedIntegerField (mcoseint)" +snippet mcoseint "CommaSeparatedIntegerField" b ${1:FIELDNAME} = models.CommaSeparatedIntegerField($2) endsnippet -snippet mdate "DateField (mdate)" +snippet mdate "DateField" b ${1:FIELDNAME} = models.DateField($2) endsnippet -snippet mdatetime "DateTimeField (mdatetime)" +snippet mdatetime "DateTimeField" b ${1:FIELDNAME} = models.DateTimeField($2) endsnippet -snippet mdecimal "DecimalField (mdecimal)" +snippet mdecimal "DecimalField" b ${1:FIELDNAME} = models.DateTimeField($2) endsnippet -snippet memail "EmailField (memail)" +snippet memail "EmailField" b ${1:FIELDNAME} = models.EmailField($2) endsnippet -snippet mfile "FileField (mfile)" +snippet mfile "FileField" b ${1:FIELDNAME} = models.FileField($2) endsnippet -snippet mfilepath "FilePathField (mfilepath)" +snippet mfilepath "FilePathField" b ${1:FIELDNAME} = models.FilePathField($2) endsnippet -snippet mfloat "FloatField (mfloat)" +snippet mfloat "FloatField" b ${1:FIELDNAME} = models.FloatField($2) endsnippet -snippet fk "ForeignKey (fk)" +snippet fk "ForeignKey" b ${1:FIELDNAME} = models.ForeignKey($2) endsnippet -snippet mip "IPAddressField (mip)" +snippet mip "IPAddressField" b ${1:FIELDNAME} = models.IPAddressField($2) endsnippet -snippet mimg "ImageField (mimg)" +snippet mimg "ImageField" b ${1:FIELDNAME} = models.ImageField($2) endsnippet -snippet mint "IntegerField (mint)" +snippet mint "IntegerField" b ${1:FIELDNAME} = models.IntegerField($2) endsnippet -snippet m2m "ManyToManyField (m2m)" +snippet m2m "ManyToManyField" b ${1:FIELDNAME} = models.ManyToManyField($2) endsnippet -snippet mnullbool "NullBooleanField (mnullbool)" +snippet mnullbool "NullBooleanField" b ${1:FIELDNAME} = models.NullBooleanField($2) endsnippet -snippet o2o "OneToOneField (o2o)" +snippet o2o "OneToOneField" b ${1:FIELDNAME} = models.OneToOneField($2) endsnippet -snippet mphone "PhoneNumberField (mphone)" +snippet mphone "PhoneNumberField" b ${1:FIELDNAME} = models.PhoneNumberField($2) endsnippet -snippet mposint "PositiveIntegerField (mposint)" +snippet mposint "PositiveIntegerField" b ${1:FIELDNAME} = models.PositiveIntegerField($2) endsnippet -snippet mpossmallint "PositiveSmallIntegerField (mpossmallint)" +snippet mpossmallint "PositiveSmallIntegerField" b ${1:FIELDNAME} = models.PositiveSmallIntegerField($2) endsnippet -snippet mslug "SlugField (mslug)" +snippet mslug "SlugField" b ${1:FIELDNAME} = models.SlugField($2) endsnippet -snippet msmallint "SmallIntegerField (msmallint)" +snippet msmallint "SmallIntegerField" b ${1:FIELDNAME} = models.SmallIntegerField($2) endsnippet -snippet mtext "TextField (mtext)" +snippet mtext "TextField" b ${1:FIELDNAME} = models.TextField($2) endsnippet -snippet mtime "TimeField (mtime)" +snippet mtime "TimeField" b ${1:FIELDNAME} = models.TimeField($2) endsnippet -snippet murl "URLField (murl)" +snippet murl "URLField" b ${1:FIELDNAME} = models.URLField($2) endsnippet -snippet musstate "USStateField (musstate)" +snippet musstate "USStateField" b ${1:FIELDNAME} = models.USStateField($2) endsnippet -snippet mxml "XMLField (mxml)" +snippet mxml "XMLField" b ${1:FIELDNAME} = models.XMLField($2) endsnippet -########################################################################### -# VIEWS SNIPPETS # -########################################################################### +# VIEWS SNIPPETS -snippet adminview "Model Admin View" +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 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" +snippet createview "Generic Create View" b class ${1:MODEL_NAME}CreateView(CreateView): - model = ${1:MODEL_NAME} - template_name = "${2:TEMPLATE_NAME}" + model = ${1:MODEL_NAME} + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet deleteview "Generic Delete View" +snippet deleteview "Generic Delete View" b class ${1:MODEL_NAME}DeleteView(DeleteView): - model = ${1:MODEL_NAME} - template_name = "${2:TEMPLATE_NAME}" + model = ${1:MODEL_NAME} + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet detailview "Generic Detail View" +snippet detailview "Generic Detail View" b class ${1:MODEL_NAME}DetailView(DetailView): - model = ${1:MODEL_NAME} - template_name = "${2:TEMPLATE_NAME}" + model = ${1:MODEL_NAME} + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet listview "Generic List View" +snippet listview "Generic List View" b class ${1:MODEL_NAME}ListView(ListView): - model = ${1:MODEL_NAME} - template_name = "${2:TEMPLATE_NAME}" + model = ${1:MODEL_NAME} + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet stackedinline "Stacked Inline" +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},) + ''' + 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" +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},) + ''' + 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" +snippet templateview "Generic Template View" b class ${1:CLASS_NAME}(TemplateView): - template_name = "${2:TEMPLATE_NAME}" + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet updateview "Generic Update View" +snippet updateview "Generic Update View" b class ${1:MODEL_NAME}UpdateView(UpdateView): - model = ${1:MODEL_NAME} - template_name = "${2:TEMPLATE_NAME}" + model = ${1:MODEL_NAME} + template_name = "${2:TEMPLATE_NAME}" endsnippet -snippet dispatch "Dispatch View method" +snippet dispatch "Dispatch View method" b def dispatch(self, request, *args, **kwargs): - return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs) + return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs) endsnippet -snippet context "get_context_data view method" +snippet context "get_context_data view method" b def get_context_data(self, **kwargs): - context = super(${1:CLASS_NAME}, self).get_context_data(**kwargs) - return context + kwargs['extra_context'] = ${1:'New Value'} + return super(${2:CLASS_NAME}, self).get_context_data(**kwargs) endsnippet diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index 3c6bc59..c04fc9d 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -3,7 +3,7 @@ priority -50 extends html # Generic Tags -snippet % +snippet % '' b {% ${1} %}${2} endsnippet @@ -156,13 +156,13 @@ endsnippet snippet with {% with ${1} as ${2} %} - ${3:$VISUAL} + ${VISUAL} {% endwith %} endsnippet snippet verbatim {% verbatim %} - ${1:$VISUAL} + ${VISUAL} {% endverbatim %} endsnippet @@ -175,7 +175,7 @@ snippet staticu endsnippet snippet static -{% static "${1:$VISUAL}" %} +{% static "${VISUAL}" %} endsnippet snippet mediau @@ -183,7 +183,7 @@ snippet mediau endsnippet snippet iblock -{% block ${1:blockname} %}${2:$VISUAL}{% endblock ${1:blockname} %} +{% block ${1:blockname} %}${VISUAL}{% endblock $1 %} endsnippet snippet csfr @@ -192,7 +192,7 @@ endsnippet snippet blocktrans {% blocktrans %} - ${1:$VISUAL} + ${VISUAL} {% endblocktrans %} endsnippet diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index 1b6391c..3ee7d92 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -1,7 +1,5 @@ priority -50 -extends django - ########################################################################### # TEXTMATE SNIPPETS # ########################################################################### From 308dc53a4c1c6cd7e91c7eccc7483aab4bcaa8c6 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Sun, 2 Aug 2015 23:40:00 -0400 Subject: [PATCH 12/15] Test djangohtml options --- UltiSnips/htmldjango.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index c04fc9d..4bb60f9 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -3,7 +3,7 @@ priority -50 extends html # Generic Tags -snippet % '' b +snippet % b {% ${1} %}${2} endsnippet From 7439b143fba4974e165d6e25e7f92e4a3241e90d Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Sun, 2 Aug 2015 23:41:17 -0400 Subject: [PATCH 13/15] Add some options to test on templates --- UltiSnips/htmldjango.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index 4bb60f9..0ec67d6 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -3,7 +3,7 @@ priority -50 extends html # Generic Tags -snippet % b +snippet % "" b {% ${1} %}${2} endsnippet From 0af7853c6b671ffbc04ae14dd08263c29e7e0c0f Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Sun, 2 Aug 2015 23:51:19 -0400 Subject: [PATCH 14/15] Add some context for djangohtml --- UltiSnips/htmldjango.snippets | 128 +++++++++++++++++----------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets index 0ec67d6..ad57150 100644 --- a/UltiSnips/htmldjango.snippets +++ b/UltiSnips/htmldjango.snippets @@ -3,200 +3,200 @@ priority -50 extends html # Generic Tags -snippet % "" b +snippet % "" bi {% ${1} %}${2} endsnippet -snippet %% +snippet %% "" bi {% ${1:tag_name} %} ${2} {% end$1 %} endsnippet -snippet { +snippet { "" bi {{ ${1} }}${2} endsnippet # Template Tags -snippet autoescape +snippet autoescape "" bi {% autoescape ${1:off} %} ${2} {% endautoescape %} endsnippet -snippet block +snippet block "" bi {% block ${1} %} ${2} {% endblock $1 %} endsnippet -snippet # +snippet # "" bi {# ${1:comment} #} endsnippet -snippet comment +snippet comment "" bi {% comment %} ${1} {% endcomment %} endsnippet -snippet cycle +snippet cycle "" bi {% cycle ${1:val1} ${2:val2} ${3:as ${4}} %} endsnippet -snippet debug +snippet debug "" bi {% debug %} endsnippet -snippet extends +snippet extends "" bi {% extends "${1:base.html}" %} endsnippet -snippet filter +snippet filter "" bi {% filter ${1} %} ${2} {% endfilter %} endsnippet -snippet firstof +snippet firstof "" bi {% firstof ${1} %} endsnippet -snippet for +snippet for "" bi {% for ${1} in ${2} %} ${3} {% endfor %} endsnippet -snippet empty +snippet empty "" bi {% empty %} ${1} endsnippet -snippet if +snippet if "" bi {% if ${1} %} ${2} {% endif %} endsnippet -snippet iif +snippet iif "" bi {% if ${1} %}${2}{% endif %} endsnippet -snippet ielse +snippet ielse "" bi {% else %}${1} endsnippet -snippet else +snippet else "" bi {% else %} ${1} endsnippet -snippet ielif +snippet ielif "" bi {% elif %}${1} endsnippet -snippet elif +snippet elif "" bi {% elif %} ${1} endsnippet -snippet ifchanged +snippet ifchanged "" bi {% ifchanged %}${1}{% endifchanged %} endsnippet -snippet ifequal +snippet ifequal "" bi {% ifequal ${1} ${2} %} ${3} {% endifequal %} endsnippet -snippet ifnotequal +snippet ifnotequal "" bi {% ifnotequal ${1} ${2} %} ${3} {% endifnotequal %} endsnippet -snippet include +snippet include "" bi {% include "${1}" %} endsnippet -snippet load +snippet load "" bi {% load ${1} %} endsnippet -snippet now +snippet now "" bi {% now "${1:jS F Y H:i}" %} endsnippet -snippet regroup +snippet regroup "" bi {% regroup ${1} by ${2} as ${3} %} endsnippet -snippet spaceless +snippet spaceless "" bi {% spaceless %}${1}{% endspaceless %} endsnippet -snippet ssi +snippet ssi "" bi {% ssi ${1} %} endsnippet -snippet trans +snippet trans "" bi {% trans "${1:string}" %} endsnippet -snippet url +snippet url "" bi {% url ${1} as ${2} %} endsnippet -snippet widthratio +snippet widthratio "" bi {% widthratio ${1:this_value} ${2:max_value} ${3:100} %} endsnippet -snippet with +snippet with "" bi {% with ${1} as ${2} %} ${VISUAL} {% endwith %} endsnippet -snippet verbatim +snippet verbatim "" bi {% verbatim %} ${VISUAL} {% endverbatim %} endsnippet -snippet super +snippet super "" bi {{ block.super }} endsnippet -snippet staticu +snippet staticu "" bi {{ STATIC_URL }} endsnippet -snippet static +snippet static "" bi {% static "${VISUAL}" %} endsnippet -snippet mediau +snippet mediau "" bi {{ MEDIA_URL }} endsnippet -snippet iblock +snippet iblock "" bi {% block ${1:blockname} %}${VISUAL}{% endblock $1 %} endsnippet -snippet csfr +snippet csfr "" bi {% csrf_token %} endsnippet -snippet blocktrans +snippet blocktrans "" bi {% blocktrans %} ${VISUAL} {% endblocktrans %} endsnippet -snippet lorem +snippet lorem "" bi {% lorem ${1} %} endsnippet @@ -208,91 +208,91 @@ endsnippet # Note: Template tags that take no arguments are not implemented. -snippet add +snippet add "" bi add:"${1}" endsnippet -snippet center +snippet center "" bi center:"${1}" endsnippet -snippet cut +snippet cut "" bi cut:"${1}" endsnippet -snippet date +snippet date "" bi date:"${1}" endsnippet -snippet default +snippet default "" bi default:"${1}" endsnippet -snippet defaultifnone +snippet defaultifnone "" bi default_if_none:"${1}" endsnippet -snippet dictsort +snippet dictsort "" bi dictsort:"${1}" endsnippet -snippet dictsortrev +snippet dictsortrev "" bi dictsortreversed:"${1}" endsnippet -snippet divisibleby +snippet divisibleby "" bi divisibleby:"${1}" endsnippet -snippet floatformat +snippet floatformat "" bi floatformat:"${1}" endsnippet -snippet getdigit +snippet getdigit "" bi get_digit:"${1}" endsnippet -snippet join +snippet join "" bi join:"${1}" endsnippet -snippet lengthis +snippet lengthis "" bi length_is:"${1}" endsnippet -snippet pluralize +snippet pluralize "" bi pluralize:"${1}" endsnippet -snippet removetags +snippet removetags "" bi removetags:"${1}" endsnippet -snippet slice +snippet slice "" bi slice:"${1}" endsnippet -snippet stringformat +snippet stringformat "" bi stringformat:"${1}" endsnippet -snippet time +snippet time "" bi time:"${1}" endsnippet -snippet truncatewords +snippet truncatewords "" bi truncatewords:${1} endsnippet -snippet truncatewordshtml +snippet truncatewordshtml "" bi truncatewords_html:${1} endsnippet -snippet urlizetrunc +snippet urlizetrunc "" bi urlizetrunc:${1} endsnippet -snippet wordwrap +snippet wordwrap "" bi wordwrap:${1} endsnippet From ba44606abdc76003555dca66d3153883f38a7531 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cruz Carballo Date: Wed, 5 Aug 2015 08:28:51 -0400 Subject: [PATCH 15/15] Add default __str__ method --- UltiSnips/django.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/django.snippets b/UltiSnips/django.snippets index 6271594..eabd80f 100644 --- a/UltiSnips/django.snippets +++ b/UltiSnips/django.snippets @@ -130,7 +130,7 @@ class ${1:MODELNAME}(models.Model): verbose_name_plural = "$1s" def __str__(self): - pass + return super($1, self).__str__() endsnippet