django-f4596197.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import{g as d}from"./index-d7fba904.js";function r(l,o){for(var t=0;t<o.length;t++){const e=o[t];if(typeof e!="string"&&!Array.isArray(e)){for(const n in e)if(n!=="default"&&!(n in l)){const i=Object.getOwnPropertyDescriptor(e,n);i&&Object.defineProperty(l,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}};(function(l,o){ace.define("ace/snippets/django.snippets",["require","exports","module"],function(t,e,n){n.exports=`# Model Fields
  2. # Note: Optional arguments are using defaults that match what Django will use
  3. # as a default, e.g. with max_length fields. Doing this as a form of self
  4. # documentation and to make it easy to know whether you should override the
  5. # default or not.
  6. # Note: Optional arguments that are booleans will use the opposite since you
  7. # can either not specify them, or override them, e.g. auto_now_add=False.
  8. snippet auto
  9. \${1:FIELDNAME} = models.AutoField(\${2})
  10. snippet bool
  11. \${1:FIELDNAME} = models.BooleanField(\${2:default=True})
  12. snippet char
  13. \${1:FIELDNAME} = models.CharField(max_length=\${2}\${3:, blank=True})
  14. snippet comma
  15. \${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=\${2}\${3:, blank=True})
  16. snippet date
  17. \${1:FIELDNAME} = models.DateField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True})
  18. snippet datetime
  19. \${1:FIELDNAME} = models.DateTimeField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True})
  20. snippet decimal
  21. \${1:FIELDNAME} = models.DecimalField(max_digits=\${2}, decimal_places=\${3})
  22. snippet email
  23. \${1:FIELDNAME} = models.EmailField(max_length=\${2:75}\${3:, blank=True})
  24. snippet file
  25. \${1:FIELDNAME} = models.FileField(upload_to=\${2:path/for/upload}\${3:, max_length=100})
  26. snippet filepath
  27. \${1:FIELDNAME} = models.FilePathField(path=\${2:"/abs/path/to/dir"}\${3:, max_length=100}\${4:, match="*.ext"}\${5:, recursive=True}\${6:, blank=True, })
  28. snippet float
  29. \${1:FIELDNAME} = models.FloatField(\${2})
  30. snippet image
  31. \${1:FIELDNAME} = models.ImageField(upload_to=\${2:path/for/upload}\${3:, height_field=height, width_field=width}\${4:, max_length=100})
  32. snippet int
  33. \${1:FIELDNAME} = models.IntegerField(\${2})
  34. snippet ip
  35. \${1:FIELDNAME} = models.IPAddressField(\${2})
  36. snippet nullbool
  37. \${1:FIELDNAME} = models.NullBooleanField(\${2})
  38. snippet posint
  39. \${1:FIELDNAME} = models.PositiveIntegerField(\${2})
  40. snippet possmallint
  41. \${1:FIELDNAME} = models.PositiveSmallIntegerField(\${2})
  42. snippet slug
  43. \${1:FIELDNAME} = models.SlugField(max_length=\${2:50}\${3:, blank=True})
  44. snippet smallint
  45. \${1:FIELDNAME} = models.SmallIntegerField(\${2})
  46. snippet text
  47. \${1:FIELDNAME} = models.TextField(\${2:blank=True})
  48. snippet time
  49. \${1:FIELDNAME} = models.TimeField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True})
  50. snippet url
  51. \${1:FIELDNAME} = models.URLField(\${2:verify_exists=False}\${3:, max_length=200}\${4:, blank=True})
  52. snippet xml
  53. \${1:FIELDNAME} = models.XMLField(schema_path=\${2:None}\${3:, blank=True})
  54. # Relational Fields
  55. snippet fk
  56. \${1:FIELDNAME} = models.ForeignKey(\${2:OtherModel}\${3:, related_name=''}\${4:, limit_choices_to=}\${5:, to_field=''})
  57. snippet m2m
  58. \${1:FIELDNAME} = models.ManyToManyField(\${2:OtherModel}\${3:, related_name=''}\${4:, limit_choices_to=}\${5:, symmetrical=False}\${6:, through=''}\${7:, db_table=''})
  59. snippet o2o
  60. \${1:FIELDNAME} = models.OneToOneField(\${2:OtherModel}\${3:, parent_link=True}\${4:, related_name=''}\${5:, limit_choices_to=}\${6:, to_field=''})
  61. # Code Skeletons
  62. snippet form
  63. class \${1:FormName}(forms.Form):
  64. """\${2:docstring}"""
  65. \${3}
  66. snippet model
  67. class \${1:ModelName}(models.Model):
  68. """\${2:docstring}"""
  69. \${3}
  70. class Meta:
  71. \${4}
  72. def __unicode__(self):
  73. \${5}
  74. def save(self, force_insert=False, force_update=False):
  75. \${6}
  76. @models.permalink
  77. def get_absolute_url(self):
  78. return ('\${7:view_or_url_name}' \${8})
  79. snippet modeladmin
  80. class \${1:ModelName}Admin(admin.ModelAdmin):
  81. \${2}
  82. admin.site.register($1, $1Admin)
  83. snippet tabularinline
  84. class \${1:ModelName}Inline(admin.TabularInline):
  85. model = $1
  86. snippet stackedinline
  87. class \${1:ModelName}Inline(admin.StackedInline):
  88. model = $1
  89. snippet r2r
  90. return render_to_response('\${1:template.html}', {
  91. \${2}
  92. }\${3:, context_instance=RequestContext(request)}
  93. )
  94. `}),ace.define("ace/snippets/django",["require","exports","module","ace/snippets/django.snippets"],function(t,e,n){e.snippetText=t("./django.snippets"),e.scope="django"}),function(){ace.require(["ace/snippets/django"],function(t){l&&(l.exports=t)})}()})(a);var s=a.exports;const p=d(s),$=r({__proto__:null,default:p},[s]);export{$ as d};