django-误解点

django-误解点

  • Model field reference

blank

Field.blank

If True, the field is allowed to be blank. Default is False.

Note that this is different than null. null is purely database-related, whereas blank is validation-related. If a field has blank=True, form validation will allow entry of an empty value. If a field has blank=False, the field will be required. 原来blank只是为了validation所用,不在数据层检查,也就是说能存空白的.

Loading Disqus comments...
Table of Contents