summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-04 11:07:05 -0500
committerTim Graham <timograham@gmail.com>2016-01-08 19:00:56 -0500
commitc432dd40bde37667bfe6bb59eaff0a14c50cd27b (patch)
tree45ba57b9e57338bfd130c8c2e9b81ff0e870a257 /docs
parent5052f79df45d843d1e44dcc47152ed503220098f (diff)
Refs #25995 -- Documented that JSONField doesn't handle sophisticated serialization.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/postgres/fields.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt
index f5c98929b7..cb6f15acc5 100644
--- a/docs/ref/contrib/postgres/fields.txt
+++ b/docs/ref/contrib/postgres/fields.txt
@@ -467,6 +467,12 @@ JSONField
its Python native format: dictionaries, lists, strings, numbers, booleans
and ``None``.
+ If you want to store other data types, you'll need to serialize them first.
+ For example, you might cast a ``datetime`` to a string. You might also want
+ to convert the string back to a ``datetime`` when you retrieve the data
+ from the database. There are some third-party ``JSONField`` implementations
+ which do this sort of thing automatically.
+
If you give the field a :attr:`~django.db.models.Field.default`, ensure
it's a callable such as ``dict`` (for an empty default) or a callable that
returns a dict (such as a function). Incorrectly using ``default={}``