Build Django apps faster with Atom.
$ apm install atom-django
Or Settings ➔ Install ➔ Search for atom-django
This plugin features several snippets to help you write boilerplate code faster, mostly for writing out models' Fields. These snippets also have preset insertion points that let you tab between various parts of the snippet that you likely want to change. These are noted in the snippets below as $1
, $2
, and so on. Occasionally these have default values inside them such as ${1:default value}
.
model
becomes:
class ${1:Modelname}(models.Model):
"""${2:($1 description)}"""
$0
def __unicode__(self):
return u"$1"
auto
becomes:
${1:FIELDNAME} = models.AutoField()
boolean
becomes:
${1:FIELDNAME} = models.BooleanField(${2:default=True})
char
becomes:
${1:FIELDNAME} = models.CharField(${2:blank=True}, max_length=${3:100})
commaseparatedinteger
becomes:
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=$2)
date
becomes:
${1:FIELDNAME} = models.DateField(${2:default=datetime.datetime.today})
datetime
becomes:
${1:FIELDNAME} = models.DateTimeField(${2:blank=True}${3:, default=datetime.datetime.now})
decimal
becomes:
${1:FIELDNAME} = models.DecimalField(max_digits=$2, decimal_places=$3)
email
becomes:
${1:FIELDNAME} = models.EmailField()
file
becomes:
${1:FIELDNAME} = models.FileField(upload_to=${1:/path/for/upload})
filepath
becomes:
${1:FIELDNAME} = models.FilePathField(path="${1:/location/of/choices}"${2:, match="${3:regex}"}${4:, recursive=True})
float
becomes:
${1:FIELDNAME} = models.FloatField()
fk
becomes:
${1:FIELDNAME} = models.ForeignKey(${2:RELATED_MODEL})
ipaddress
becomes:
${1:FIELDNAME} = models.IPAddressField(${2:blank=True})
image
becomes:
${1:FIELDNAME} = models.ImageField(upload_to="${2:/dir/path}"${3:, height_field=$4}${5:, width_field=$6})
integer
becomes:
${1:FIELDNAME} = models.IntegerField(${2:blank=True, null=True})
manytomany
becomes:
${1:FIELDNAME} = models.ManyToManyField(${2:RELATED_MODEL})
nullboolean
becomes:
${1:FIELDNAME} = models.NullBooleanField(${2:default=True})
phonenumber
becomes:
${1:FIELDNAME} = models.PhoneNumberField(${2:blank=True})
positiveinteger
becomes:
${1:FIELDNAME} = models.PositiveIntegerField(${2:blank=True, null=True})
positivesmallinteger
becomes:
${1:FIELDNAME} = models.PositiveSmallIntegerField(${2:blank=True, null=True})
slug
becomes:
${1:slug} = models.SlugField()
smallinteger
becomes:
${1:FIELDNAME} = models.SmallIntegerField(${2:blank=True, null=True})
text
becomes:
${1:FIELDNAME} = models.TextField(${2:blank=True})
time
becomes:
${1:FIELDNAME} = models.TimeField(${2:blank=True})
url
becomes:
${1:FIELDNAME} = models.URLField(${2:blank=True})
usstate
becomes:
${1:FIELDNAME} = models.USStateField(${2:blank=True})
xml
becomes:
${1:FIELDNAME} = models.XMLField(schema_path=${2:/path/to/RelaxNG}${3:, blank=True})
sendmail
becomes:
mail.send_mail("${1:Subject}", "${2:Message}", "${3:[email protected]}", ${4:["[email protected]"]}${5:, fail_silently=True})
- Fix a syntax highlighting bug.
- Initial build of Django for Atom.
- At the moment it is merely a clone of the superb Django TextMate bundle but new content may be added in the future.
MIT © Zachary Jones