Commit 700717db authored by Tim Graham's avatar Tim Graham
Browse files

[1.4.X] Fixed #17388 - Noted in the custom model field docs that field methods...

[1.4.X] Fixed #17388 - Noted in the custom model field docs that field methods need to handle None if the field may be null.

Backport of 4cef9a09 from master
parent fd90a906
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -447,6 +447,13 @@ called when it is created, you should be using `The SubfieldBase metaclass`_
mentioned earlier. Otherwise :meth:`.to_python` won't be called
automatically.

.. warning::

    If your custom field allows ``null=True``, any field method that takes
    ``value`` as an argument, like :meth:`~Field.to_python` and
    :meth:`~Field.get_prep_value`, should handle the case when ``value`` is
    ``None``.

Converting Python objects to query values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~