# Django 2.0 文章集 [8] django ORM 筆記 -1 ###### tags: `Django`, `django2.0`, `python` 常見(成對存在)的屬性設定參數: (1) models.XXField(null=True, blank=True) (2) models.XXField(default="xxx", blank=True) Explanation ------------ default="xxx": 設定該欄位預設值 => 非必要欄位,大多都會設定 blank=True => 無論如何一定要有值,則 blank=False blank=True: 設定該欄位可留白(非必填) null=True: 設定該欄位若留白,為"NULL" (相反為 NOT NULL) (1) null=False (default) => 空字串 (i.e., '') (1) null=True => NULL (用 python 讀出應是 None) [重點] null=True, blank=True 必定同時滿足。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up