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
|
2015-08-02 23:37:31 -04:00
|
|
|
|
# FORMS SNIPPETS
|
2015-07-10 16:45:53 -04:00
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet form "Form" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
class ${1:FORMNAME}(forms.Form):
|
2015-07-10 19:43:24 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
${2:# TODO: Define form fields here}
|
2015-07-10 16:45:53 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet modelform "ModelForm" b
|
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 22:46:18 -04:00
|
|
|
|
class Meta:
|
|
|
|
|
model = $1
|
2015-07-10 16:45:53 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fbool "BooleanField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.BooleanField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fchar "CharField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.CharField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fchoice "ChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fcombo "ComboField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ComboField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fdate "DateField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DateField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fdatetime "DateTimeField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DateTimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fdecimal "DecimalField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.DecimalField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fmail "EmailField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.EmailField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ffile "FileField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FileField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ffilepath "FilePathField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FilePathField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ffloat "FloatField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.FloatField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fip "IPAddressField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.IPAddressField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fimg "ImageField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ImageField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fint "IntegerField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.IntegerField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fmochoice "ModelChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fmomuchoice "ModelMultipleChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fmuval "MultiValueField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.MultiValueField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fmuchoice "MultipleChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fnullbool "NullBooleanField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.NullBooleanField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet freg "RegexField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.RegexField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fslug "SlugField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.SlugField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fsdatetime "SplitDateTimeField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ftime "TimeField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TimeField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ftchoice "TypedChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet ftmuchoice "TypedMultipleChoiceField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet furl "URLField" b
|
2015-07-10 16:45:53 -04:00
|
|
|
|
${1:FIELDNAME} = forms.URLField($2)
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
# MODELS SNIPPETS
|
2015-07-10 16:45:53 -04:00
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet model "Model" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODELNAME}(models.Model):
|
2015-07-10 22:46:18 -04:00
|
|
|
|
${0}
|
|
|
|
|
class Meta:
|
|
|
|
|
verbose_name = "$1"
|
|
|
|
|
verbose_name_plural = "$1s"
|
2015-07-10 16:45:53 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
def __str__(self):
|
2015-08-05 08:28:51 -04:00
|
|
|
|
return super($1, self).__str__()
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet modelfull "Model" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODELNAME}(models.Model):
|
2015-07-10 22:46:18 -04:00
|
|
|
|
${2:# TODO: Define fields here}
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
class Meta:
|
|
|
|
|
verbose_name = "$1"
|
|
|
|
|
verbose_name_plural = "$1s"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
def __str__(self):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
return super($1, self).__str__()
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
def save(self):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
return super($1, self).save()
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
@models.permalink
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
|
return ('')
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-07-10 22:46:18 -04:00
|
|
|
|
${3:# TODO: Define custom methods here}
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mauto "AutoField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.AutoField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mbigint "BigIntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.BigIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mbool "BooleanField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.BooleanField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mchar "CharField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mcoseint "CommaSeparatedIntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mdate "DateField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.DateField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mdatetime "DateTimeField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.DateTimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mdecimal "DecimalField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.DateTimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet memail "EmailField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.EmailField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mfile "FileField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.FileField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mfilepath "FilePathField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.FilePathField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mfloat "FloatField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.FloatField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet fk "ForeignKey" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.ForeignKey($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mip "IPAddressField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.IPAddressField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mimg "ImageField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.ImageField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mint "IntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.IntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet m2m "ManyToManyField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.ManyToManyField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mnullbool "NullBooleanField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.NullBooleanField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet o2o "OneToOneField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.OneToOneField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mphone "PhoneNumberField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.PhoneNumberField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mposint "PositiveIntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mpossmallint "PositiveSmallIntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mslug "SlugField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.SlugField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet msmallint "SmallIntegerField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.SmallIntegerField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mtext "TextField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.TextField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mtime "TimeField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.TimeField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet murl "URLField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.URLField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet musstate "USStateField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.USStateField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet mxml "XMLField" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
${1:FIELDNAME} = models.XMLField($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
# VIEWS SNIPPETS
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet adminview "Model Admin View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1}Admin(admin.ModelAdmin):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
'''
|
|
|
|
|
Admin View for ${1}
|
|
|
|
|
'''
|
|
|
|
|
list_display = ('${2}',)
|
|
|
|
|
list_filter = ('${3}',)
|
|
|
|
|
inlines = [
|
|
|
|
|
${4}Inline,
|
|
|
|
|
]
|
|
|
|
|
raw_id_fields = ('${5}',)
|
|
|
|
|
readonly_fields = ('${6}',)
|
|
|
|
|
search_fields = ['${7}']
|
2015-07-10 19:43:24 -04:00
|
|
|
|
admin.site.register(${1}, ${1}Admin)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet createview "Generic Create View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODEL_NAME}CreateView(CreateView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet deleteview "Generic Delete View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet detailview "Generic Detail View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODEL_NAME}DetailView(DetailView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet listview "Generic List View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODEL_NAME}ListView(ListView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet stackedinline "Stacked Inline" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1}Inline(admin.StackedInline):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
'''
|
|
|
|
|
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-08-02 23:37:31 -04:00
|
|
|
|
snippet tabularinline "Tabular Inline" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1}Inline(admin.TabularInline):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
'''
|
|
|
|
|
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-08-02 23:37:31 -04:00
|
|
|
|
snippet templateview "Generic Template View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:CLASS_NAME}(TemplateView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet updateview "Generic Update View" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
model = ${1:MODEL_NAME}
|
|
|
|
|
template_name = "${2:TEMPLATE_NAME}"
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet dispatch "Dispatch View method" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
def dispatch(self, request, *args, **kwargs):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|
|
|
|
|
|
2015-08-02 23:37:31 -04:00
|
|
|
|
snippet context "get_context_data view method" b
|
2015-07-10 19:43:24 -04:00
|
|
|
|
def get_context_data(self, **kwargs):
|
2015-08-02 23:37:31 -04:00
|
|
|
|
kwargs['extra_context'] = ${1:'New Value'}
|
|
|
|
|
return super(${2:CLASS_NAME}, self).get_context_data(**kwargs)
|
2013-03-17 15:13:47 -04:00
|
|
|
|
endsnippet
|