﻿{"id":581,"date":"2011-07-30T21:43:12","date_gmt":"2011-07-30T13:43:12","guid":{"rendered":"http:\/\/nick.workao.org\/?p=581"},"modified":"2021-11-17T11:34:08","modified_gmt":"2021-11-17T03:34:08","slug":"django%e6%95%b0%e6%8d%ae%e5%ba%93%e6%a8%a1%e5%9e%8b%e7%9a%84%e5%ad%97%e6%ae%b5%e7%b1%bb%e5%9e%8b%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/python\/581","title":{"rendered":"Django\u6570\u636e\u5e93\u6a21\u578b\u7684\u5b57\u6bb5\u7c7b\u578b\u603b\u7ed3"},"content":{"rendered":"<p>\u4ece\u7f51\u4e0a\u627e\u4e86\u597d\u957f\u65f6\u95f4\uff0c\u603b\u7b97\u662f\u627e\u4e86\u4e2a\u5dee\u4e0d\u591a\u3002\u56e0\u4e3a\u7ecf\u5e38\u7528\uff0c\u81ea\u5df1\u53c8\u8bb0\u4e0d\u4f4f\uff0c\u6240\u4ee5\u8fd8\u662f\u603b\u7ed3\u4e00\u4e0b\u3002\u5e2e\u52a9\u81ea\u5df1\u7684\u540c\u65f6\u4e5f\u80fd\u5e2e\u52a9\u522b\u4eba\uff1a<\/p>\n<pre escaped=\"true\" lang=\"python\" line=\"1\">\nV=models.CharField(max_length=None[, **options])\u3000\u3000\u3000\u3000#varchar\nV=models.EmailField([max_length=75, **options])\u3000\u3000\u3000\u3000#varchar\nV=models.URLField([verify_exists=True, max_length=200, **options])\u3000\u3000\u3000\u3000#varchar\nV=models.FileField(upload_to=None[, max_length=100, **options])\u3000\u3000\u3000\u3000#varchar\n#upload_to\u6307\u5b9a\u4fdd\u5b58\u76ee\u5f55\u53ef\u5e26\u683c\u5f0f\uff0c\nV=models.ImageField(upload_to=None[, height_field=None, width_field=None, max_length=100, **options])\nV=models.IPAddressField([**options])\u3000\u3000\u3000\u3000#varchar\nV=models.FilePathField(path=None[, match=None, recursive=False, max_length=100, **options])\u3000#varchar\nV=models.SlugField([max_length=50, **options])\u3000\u3000\u3000\u3000#varchar\uff0c\u6807\u7b7e\uff0c\u5185\u542b\u7d22\u5f15\nV=models.CommaSeparatedIntegerField(max_length=None[, **options])\u3000\u3000\u3000\u3000#varchar\nV=models.IntegerField([**options])\u3000\u3000\u3000\u3000#int\nV=models.PositiveIntegerField([**options])\u3000\u3000\u3000\u3000#int \u6b63\u6574\u6570\nV=models.SmallIntegerField([**options])\u3000\u3000\u3000\u3000#smallint\nV=models.PositiveSmallIntegerField([**options])\u3000\u3000\u3000\u3000#smallint \u6b63\u6574\u6570\nV=models.AutoField(**options)\u3000\u3000\u3000\u3000#int\uff1b\u5728Django\u4ee3\u7801\u5185\u662f\u81ea\u589e\nV=models.DecimalField(max_digits=None, decimal_places=None[, **options])\u3000\u3000\u3000\u3000#decimal\nV=models.FloatField([**options])\u3000\u3000\u3000\u3000#real\nV=models.BooleanField(**options)\u3000\u3000\u3000\u3000#boolean\u6216bit\nV=models.NullBooleanField([**options])\u3000\u3000\u3000\u3000#bit\u5b57\u6bb5\u4e0a\u53ef\u4ee5\u8bbe\u7f6e\u4e0anull\u503c\nV=models.DateField([auto_now=False, auto_now_add=False, **options])\u3000\u3000\u3000\u3000#date\n#auto_now\u6700\u540e\u4fee\u6539\u8bb0\u5f55\u7684\u65e5\u671f\uff1bauto_now_add\u6dfb\u52a0\u8bb0\u5f55\u7684\u65e5\u671f\nV=models.DateTimeField([auto_now=False, auto_now_add=False, **options])\u3000\u3000\u3000\u3000#datetime\nV=models.TimeField([auto_now=False, auto_now_add=False, **options])\u3000\u3000\u3000\u3000#time\nV=models.TextField([**options])\u3000\u3000\u3000\u3000#text\nV=models.XMLField(schema_path=None[, **options])\u3000\u3000\u3000\u3000#text\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\nV=models.ForeignKey(othermodel[, **options])\u3000\u3000\u3000\u3000#\u5916\u952e\uff0c\u5173\u8054\u5176\u5b83\u6a21\u578b\uff0c\u521b\u5efa\u5173\u8054\u7d22\u5f15\nV=models.ManyToManyField(othermodel[, **options])\u3000\u3000\u3000\u3000#\u591a\u5bf9\u591a\uff0c\u5173\u8054\u5176\u5b83\u6a21\u578b\uff0c\u521b\u5efa\u5173\u8054\u8868\nV=models.OneToOneField(othermodel[, parent_link=False, **options])\u3000\u3000\u3000\u3000#\u4e00\u5bf9\u4e00\uff0c\u5b57\u6bb5\u5173\u8054\u8868\u5c5e\u6027\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>\u4ece\u7f51\u4e0a\u627e\u4e86\u597d\u957f\u65f6\u95f4\uff0c\u603b\u7b97\u662f\u627e\u4e86\u4e2a\u5dee\u4e0d\u591a\u3002\u56e0\u4e3a\u7ecf\u5e38\u7528\uff0c\u81ea\u5df1\u53c8\u8bb0\u4e0d\u4f4f\uff0c\u6240\u4ee5\u8fd8\u662f\u603b\u7ed3\u4e00\u4e0b\u3002\u5e2e\u52a9\u81ea\u5df1\u7684\u540c\u65f6\u4e5f\u80fd\u5e2e\u52a9\u522b\u4eba\uff1a V=models.CharField(max_length=None[, **opti&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[310,311],"class_list":["post-581","post","type-post","status-publish","format-standard","hentry","category-python","tag-django-2","tag-models"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=581"}],"version-history":[{"count":8,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":2228,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/581\/revisions\/2228"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}