Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #17388 - Noted in the custom model field docs that field method…

…s need to handle None if the field may be null.
  • Loading branch information...
commit 4cef9a09f9b0d89abf323a1cf8b9e8354e316c18 1 parent 0b908b9
@timgraham timgraham authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 docs/howto/custom-model-fields.txt
View
7 docs/howto/custom-model-fields.txt
@@ -448,6 +448,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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.