Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…d methods need to handle None if the field may be null.

Backport of 4cef9a0 from master
  • Loading branch information...
commit 700717db1f7e3032cfd89ea80f37eb69bc54a188 1 parent fd90a90
Tim Graham authored October 19, 2012

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  docs/howto/custom-model-fields.txt
7  docs/howto/custom-model-fields.txt
@@ -447,6 +447,13 @@ called when it is created, you should be using `The SubfieldBase metaclass`_
447 447
 mentioned earlier. Otherwise :meth:`.to_python` won't be called
448 448
 automatically.
449 449
 
  450
+.. warning::
  451
+
  452
+    If your custom field allows ``null=True``, any field method that takes
  453
+    ``value`` as an argument, like :meth:`~Field.to_python` and
  454
+    :meth:`~Field.get_prep_value`, should handle the case when ``value`` is
  455
+    ``None``.
  456
+
450 457
 Converting Python objects to query values
451 458
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
452 459
 

0 notes on commit 700717d

Please sign in to comment.
Something went wrong with that request. Please try again.