diff options
| author | Tim Graham <timograham@gmail.com> | 2012-10-19 06:52:30 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-10-19 17:54:38 -0400 |
| commit | 700717db1f7e3032cfd89ea80f37eb69bc54a188 (patch) | |
| tree | f686719e754ad09e1ca1e3ec41d2e1174f57f99e | |
| parent | fd90a906333b569340e5507fec3f3a4d4c1d0f47 (diff) | |
[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 4cef9a09f9 from master
| -rw-r--r-- | docs/howto/custom-model-fields.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt index 53fa4bd557..daaede8e15 100644 --- a/docs/howto/custom-model-fields.txt +++ b/docs/howto/custom-model-fields.txt @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
