2014-02-26 03:31:33 -05:00
|
|
|
|
priority -50
|
|
|
|
|
|
2015-07-10 16:45:53 -04:00
|
|
|
|
# This files will define django snippets from sublime text djaneiro
|
|
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
|
# FORMS SNIPPETS #
|
|
|
|
|
###########################################################################
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet form "Form"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
class ${1:FORMNAME}(forms.Form):
|
2015-07-10 19:43:24 -04:00
|
|
|
|
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${2:# TODO: Define form fields here}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet modelform "ModelForm"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
class ${1:MODELNAME}Form(forms.ModelForm):
|
2015-07-10 19:43:24 -04:00
|
|
|
|
|
2015-07-10 16:45:53 -04:00
|
|
|
|
class Meta:
|
|
|
|
|
model = $1
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fbool "BooleanField (fbool)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.BooleanField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fchar "CharField (fchar)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.CharField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fchoice "ChoiceField (fchoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fcombo "ComboField (fcombo)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ComboField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fdate "DateField (fdate)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DateField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fdatetime "DateTimeField (fdatetime)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DateTimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fdecimal "DecimalField (fdecimal)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DecimalField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fmail "EmailField (femail)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.EmailField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ffile "FileField (ffile)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FileField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ffilepath "FilePathField (ffilepath)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FilePathField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ffloat "FloatField (ffloat)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FloatField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fip "IPAddressField (fip)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.IPAddressField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fimg "ImageField (fimg)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ImageField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fint "IntegerField (fint)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.IntegerField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fmochoice "ModelChoiceField (fmochoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fmomuchoice "ModelMultipleChoiceField (fmomuchoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fmuval "MultiValueField (fmuval)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.MultiValueField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fmuchoice "MultipleChoiceField (fmuchoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fnullbool "NullBooleanField (fnullbool)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.NullBooleanField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet freg "RegexField (fregex)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.RegexField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fslug "SlugField (fslug)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.SlugField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fsdatetime "SplitDateTimeField (fsdatetime)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ftime "TimeField (ftime)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ftchoice "TypedChoiceField (ftchoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet ftmuchoice "TypedMultipleChoiceField (ftmuchoice)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet furl "URLField (furl)"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.URLField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
###########################################################################
|
|
|
|
|
# MODELS SNIPPETS #
|
|
|
|
|
###########################################################################
|
2015-07-10 16:45:53 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet model "Model"
|
|
|
|
|
class ${1:MODELNAME}(models.Model):
|
2015-07-10 16:45:53 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class Meta:
|
|
|
|
|
verbose_name = "$1"
|
|
|
|
|
verbose_name_plural = "$1s"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
def __str__(self):
|
|
|
|
|
pass
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet modelfull "Model (full)"
|
|
|
|
|
class ${1:MODELNAME}(models.Model):
|
|
|
|
|
${2:# TODO: Define fields here}
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class Meta:
|
|
|
|
|
verbose_name = "$1"
|
|
|
|
|
verbose_name_plural = "$1s"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
def __str__(self):
|
|
|
|
|
pass
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
def save(self):
|
|
|
|
|
pass
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
@models.permalink
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
|
return ('')
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${3:# TODO: Define custom methods here}
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mauto "AutoField (mauto)"
|
|
|
|
|
${1:FIELDNAME} = models.AutoField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mbigint "BigIntegerField (mbigint)"
|
|
|
|
|
${1:FIELDNAME} = models.BigIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mbool "BooleanField (mbool)"
|
|
|
|
|
${1:FIELDNAME} = models.BooleanField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mchar "CharField (mchar)"
|
|
|
|
|
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mcoseint "CommaSeparatedIntegerField (mcoseint)"
|
|
|
|
|
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mdate "DateField (mdate)"
|
|
|
|
|
${1:FIELDNAME} = models.DateField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mdatetime "DateTimeField (mdatetime)"
|
|
|
|
|
${1:FIELDNAME} = models.DateTimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mdecimal "DecimalField (mdecimal)"
|
|
|
|
|
${1:FIELDNAME} = models.DateTimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet memail "EmailField (memail)"
|
|
|
|
|
${1:FIELDNAME} = models.EmailField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mfile "FileField (mfile)"
|
|
|
|
|
${1:FIELDNAME} = models.FileField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mfilepath "FilePathField (mfilepath)"
|
|
|
|
|
${1:FIELDNAME} = models.FilePathField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mfloat "FloatField (mfloat)"
|
|
|
|
|
${1:FIELDNAME} = models.FloatField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet fk "ForeignKey (fk)"
|
|
|
|
|
${1:FIELDNAME} = models.ForeignKey($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mip "IPAddressField (mip)"
|
|
|
|
|
${1:FIELDNAME} = models.IPAddressField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mimg "ImageField (mimg)"
|
|
|
|
|
${1:FIELDNAME} = models.ImageField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mint "IntegerField (mint)"
|
|
|
|
|
${1:FIELDNAME} = models.IntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet m2m "ManyToManyField (m2m)"
|
|
|
|
|
${1:FIELDNAME} = models.ManyToManyField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mnullbool "NullBooleanField (mnullbool)"
|
|
|
|
|
${1:FIELDNAME} = models.NullBooleanField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet o2o "OneToOneField (o2o)"
|
|
|
|
|
${1:FIELDNAME} = models.OneToOneField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mphone "PhoneNumberField (mphone)"
|
|
|
|
|
${1:FIELDNAME} = models.PhoneNumberField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mposint "PositiveIntegerField (mposint)"
|
|
|
|
|
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mpossmallint "PositiveSmallIntegerField (mpossmallint)"
|
|
|
|
|
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mslug "SlugField (mslug)"
|
|
|
|
|
${1:FIELDNAME} = models.SlugField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet msmallint "SmallIntegerField (msmallint)"
|
|
|
|
|
${1:FIELDNAME} = models.SmallIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mtext "TextField (mtext)"
|
|
|
|
|
${1:FIELDNAME} = models.TextField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mtime "TimeField (mtime)"
|
|
|
|
|
${1:FIELDNAME} = models.TimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet murl "URLField (murl)"
|
|
|
|
|
${1:FIELDNAME} = models.URLField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet musstate "USStateField (musstate)"
|
|
|
|
|
${1:FIELDNAME} = models.USStateField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet mxml "XMLField (mxml)"
|
|
|
|
|
${1:FIELDNAME} = models.XMLField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
###########################################################################
|
|
|
|
|
# VIEWS SNIPPETS #
|
|
|
|
|
###########################################################################
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
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)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet createview "Generic Create View"
|
|
|
|
|
class ${1:MODEL_NAME}CreateView(CreateView):
|
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet deleteview "Generic Delete View"
|
|
|
|
|
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet detailview "Generic Detail View"
|
|
|
|
|
class ${1:MODEL_NAME}DetailView(DetailView):
|
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet listview "Generic List View"
|
|
|
|
|
class ${1:MODEL_NAME}ListView(ListView):
|
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
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},)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
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},)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet templateview "Generic Template View"
|
|
|
|
|
class ${1:CLASS_NAME}(TemplateView):
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet updateview "Generic Update View"
|
|
|
|
|
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
snippet dispatch "Dispatch View method"
|
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
|
|
|
|
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 19:43:24 -04:00
|
|
|
|
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
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-07-10 22:31:01 -04:00
|
|
|
|
###########################################################################
|
|
|
|
|
# MODEL FIELDS SNIPPETS #
|
|
|
|
|
###########################################################################
|
|
|
|
|
|
2015-07-10 22:39:49 -04:00
|
|
|
|
snippet null "null" w
|
2015-07-10 22:31:01 -04:00
|
|
|
|
null=${1:True}
|
|
|
|
|
endsnippet
|