Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
113 lines
3.7 KiB
Plaintext
113 lines
3.7 KiB
Plaintext
# Model Fields
|
|
|
|
# Note: Optional arguments are using defaults that match what Django will use
|
|
# as a default, e.g. with max_length fields. Doing this as a form of self
|
|
# documentation and to make it easy to know whether you should override the
|
|
# default or not.
|
|
|
|
# Note: Optional arguments that are booleans will use the opposite since you
|
|
# can either not specify them, or override them, e.g. auto_now_add=False.
|
|
|
|
snippet auto
|
|
${1:FIELDNAME} = models.AutoField(${0})
|
|
snippet bigint
|
|
${1:FIELDNAME} = models.BigIntegerField(${0})
|
|
snippet binary
|
|
${1:FIELDNAME} = models.BinaryField(${0})
|
|
snippet bool
|
|
${1:FIELDNAME} = models.BooleanField(${0:default=True})
|
|
snippet char
|
|
${1:FIELDNAME} = models.CharField(max_length=${2}${0:, blank=True})
|
|
snippet comma
|
|
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${0:, blank=True})
|
|
snippet date
|
|
${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
|
snippet datetime
|
|
${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
|
snippet decimal
|
|
${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${0})
|
|
snippet email
|
|
${1:FIELDNAME} = models.EmailField(max_length=${2:75}${0:, blank=True})
|
|
snippet file
|
|
${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${0:, max_length=100})
|
|
snippet filepath
|
|
${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${0:, blank=True, })
|
|
snippet float
|
|
${1:FIELDNAME} = models.FloatField(${0})
|
|
snippet image
|
|
${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${0:, max_length=100})
|
|
snippet int
|
|
${1:FIELDNAME} = models.IntegerField(${0})
|
|
snippet ip
|
|
${1:FIELDNAME} = models.IPAddressField(${0})
|
|
snippet nullbool
|
|
${1:FIELDNAME} = models.NullBooleanField(${0})
|
|
snippet posint
|
|
${1:FIELDNAME} = models.PositiveIntegerField(${0})
|
|
snippet possmallint
|
|
${1:FIELDNAME} = models.PositiveSmallIntegerField(${0})
|
|
snippet slug
|
|
${1:FIELDNAME} = models.SlugField(max_length=${2:50}${0:, blank=True})
|
|
snippet smallint
|
|
${1:FIELDNAME} = models.SmallIntegerField(${0})
|
|
snippet text
|
|
${1:FIELDNAME} = models.TextField(${0:blank=True})
|
|
snippet time
|
|
${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
|
snippet url
|
|
${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${0:, blank=True})
|
|
snippet xml
|
|
${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${0:, blank=True})
|
|
# Relational Fields
|
|
snippet fk
|
|
${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${0:, to_field=''})
|
|
snippet m2m
|
|
${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${0:, db_table=''})
|
|
snippet o2o
|
|
${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${0:, to_field=''})
|
|
|
|
# Code Skeletons
|
|
|
|
snippet form
|
|
class ${1:FormName}(forms.Form):
|
|
"""${2:docstring}"""
|
|
${0}
|
|
|
|
snippet model
|
|
class ${1:ModelName}(models.Model):
|
|
"""${2:docstring}"""
|
|
${3}
|
|
|
|
class Meta:
|
|
${4}
|
|
|
|
def __unicode__(self):
|
|
${5}
|
|
|
|
def save(self, *args, **kwargs):
|
|
${6}
|
|
|
|
@models.permalink
|
|
def get_absolute_url(self):
|
|
return ('${7:view_or_url_name}' ${0})
|
|
|
|
snippet modeladmin
|
|
class ${1:ModelName}Admin(admin.ModelAdmin):
|
|
${0}
|
|
|
|
admin.site.register($1, $1Admin)
|
|
|
|
snippet tabularinline
|
|
class ${0:ModelName}Inline(admin.TabularInline):
|
|
model = $1
|
|
|
|
snippet stackedinline
|
|
class ${0:ModelName}Inline(admin.StackedInline):
|
|
model = $1
|
|
|
|
snippet r2r
|
|
return render_to_response('${1:template.html}', {
|
|
${2}
|
|
}${0:, context_instance=RequestContext(request)}
|
|
)
|