瀏覽代碼

Fixed #22224 -- Added note about supplying missing values for non-nullable fields with blank=True.

Jacob Walls 3 年之前
父節點
當前提交
cd6bddd44e
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      docs/ref/models/fields.txt

+ 6 - 0
docs/ref/models/fields.txt

@@ -73,6 +73,12 @@ purely database-related, whereas :attr:`~Field.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.
 
+.. admonition:: Supplying missing values
+
+    ``blank=True`` can be used with fields having ``null=False``, but this will
+    require implementing :meth:`~django.db.models.Model.clean` on the model in
+    order to programmatically supply any missing values.
+
 .. _field-choices:
 
 ``choices``