Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.6.x] Fixed #22145 -- Clarified docs on Field.blank and Field.null …

…options.

Thanks skipjack at peru.com for the suggestion.

Backport of 3390550 from master
  • Loading branch information...
commit f2b513c9e8416855a92e66928c2e22a8fc639273 1 parent dde67de
@navneet35371 navneet35371 authored timgraham committed
Showing with 10 additions and 12 deletions.
  1. +10 −12 docs/ref/models/fields.txt
View
22 docs/ref/models/fields.txt
@@ -39,19 +39,17 @@ The following arguments are available to all field types. All are optional.
If ``True``, Django will store empty values as ``NULL`` in the database. Default
is ``False``.
-Note that empty string values will always get stored as empty strings, not as
-``NULL``. Only use ``null=True`` for non-string fields such as integers,
-booleans and dates. For both types of fields, you will also need to set
-``blank=True`` if you wish to permit empty values in forms, as the
-:attr:`~Field.null` parameter only affects database storage (see
-:attr:`~Field.blank`).
-
Avoid using :attr:`~Field.null` on string-based fields such as
-:class:`CharField` and :class:`TextField` unless you have an excellent reason.
-If a string-based field has ``null=True``, that means it has two possible values
-for "no data": ``NULL``, and the empty string. In most cases, it's redundant to
-have two possible values for "no data;" Django convention is to use the empty
-string, not ``NULL``.
+:class:`CharField` and :class:`TextField` because empty string values will
+always be stored as empty strings, not as ``NULL``. If a string-based field has
+``null=True``, that means it has two possible values for "no data": ``NULL``,
+and the empty string. In most cases, it's redundant to have two possible values
+for "no data;" the Django convention is to use the empty string, not ``NULL``.
+
+For both string-based and non-string-based fields, you will also need to
+set ``blank=True`` if you wish to permit empty values in forms, as the
+:attr:`~Field.null` parameter only affects database storage
+(see :attr:`~Field.blank`).
.. note::
Please sign in to comment.
Something went wrong with that request. Please try again.