ref: f859385a632fc91c85d1018b8b55842008d92165
vim/snippets/python.snippets
snippet shebang #!/usr/bin/env python snippet imp import ${1:module} snippet d print dir(${1}) snippet for for ${1:needle} in ${2:haystack}: ${3:# code...} # New Function snippet def def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): ${3} # New Method snippet defs def ${1:mname}(self, ${2:arg}): ${3:pass} snippet . self. snippet ifmain if __name__ == '__main__': ${1:main()} # __magic__ snippet _ __${1:init}__${2} # Django ######################################### snippet bool ${1:FIELDNAME} = models.BooleanField(${2:default=True}) snippet char ${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True}) snippet date ${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) snippet datetime ${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True}) snippet float ${1:FIELDNAME} = models.FloatField() snippet int ${1:FIELDNAME} = models.IntegerField() snippet text ${1:FIELDNAME} = models.TextField(${2:blank=True}) snippet fk ${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''}) snippet m2m ${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''}) snippet o2o ${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''}) snippet form class ${1:FormName}(forms.Form): """${2:docstring}""" ${3} snippet model class ${1:ModelName}(models.Model): ${2:field} snippet modeladmin class ${1:ModelName}Admin(admin.ModelAdmin): ${2} admin.site.register($1, $1Admin) snippet tabularinline class ${1:ModelName}Inline(admin.TabularInline): model = $1 snippet stackedinline class ${1:ModelName}Inline(admin.StackedInline): model = $1 snippet r2r return render_to_response('${1:template.html}', { ${2} }${3:, context_instance=RequestContext(request)}) snippet geto get_object_or_404(${1:Model}, ${2:pk=1}) ${3:next} snippet " """ ${1:docs} """ snippet ipdb from ipdb import set_trace; set_trace()