diff options
| author | David Hoffman <me@davidhoffman.ca> | 2016-12-08 19:17:02 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-15 10:35:44 -0500 |
| commit | bf84d042e0bba636fe2199051fe25e96d89865da (patch) | |
| tree | 119470db1a6f0f6d5de6b66f71929c92a6a4e97f /docs | |
| parent | 9524fd9133e47fa90846904f81fe91c72f331e56 (diff) | |
Fixed #27582 -- Allowed HStoreField to store null values.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/postgres/fields.txt | 9 | ||||
| -rw-r--r-- | docs/ref/contrib/postgres/forms.txt | 8 | ||||
| -rw-r--r-- | docs/releases/1.11.txt | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt index 7c756655ce..f753f3b75e 100644 --- a/docs/ref/contrib/postgres/fields.txt +++ b/docs/ref/contrib/postgres/fields.txt @@ -275,8 +275,9 @@ A more useful index is a ``GIN`` index, which you should create using a .. class:: HStoreField(**options) - A field for storing mappings of strings to strings. The Python data type - used is a ``dict``. + A field for storing key-value pairs. The Python data type used is a + ``dict``. Keys must be strings, and values may be either strings or nulls + (``None`` in Python). To use this field, you'll need to: @@ -287,6 +288,10 @@ A more useful index is a ``GIN`` index, which you should create using a You'll see an error like ``can't adapt type 'dict'`` if you skip the first step, or ``type "hstore" does not exist`` if you skip the second. + .. versionchanged:: 1.11 + + Added the ability to store nulls. Previously, they were cast to strings. + .. note:: On occasions it may be useful to require or restrict the keys which are diff --git a/docs/ref/contrib/postgres/forms.txt b/docs/ref/contrib/postgres/forms.txt index c4af819a72..bfc7aa3e7a 100644 --- a/docs/ref/contrib/postgres/forms.txt +++ b/docs/ref/contrib/postgres/forms.txt @@ -144,8 +144,8 @@ Fields .. class:: HStoreField A field which accepts JSON encoded data for an - :class:`~django.contrib.postgres.fields.HStoreField`. It will cast all the - values to strings. It is represented by an HTML ``<textarea>``. + :class:`~django.contrib.postgres.fields.HStoreField`. It casts all values + (except nulls) to strings. It is represented by an HTML ``<textarea>``. .. admonition:: User friendly forms @@ -159,6 +159,10 @@ Fields valid for a given field. This can be done using the :class:`~django.contrib.postgres.validators.KeysValidator`. + .. versionchanged:: 1.11 + + Added the ability to store nulls. + ``JSONField`` ------------- diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index e14d76ca1f..a46edbdfb9 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -194,6 +194,10 @@ Minor features * The new :class:`~django.contrib.postgres.aggregates.JSONBAgg` allows aggregating values as a JSON array. +* :class:`~django.contrib.postgres.fields.HStoreField` and + :class:`~django.contrib.postgres.forms.HStoreField` allow storing null + values. + :mod:`django.contrib.redirects` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
