1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Added HStoreField.

Thanks to `django-hstore` for inspiration in some areas, and many people
for reviews.
This commit is contained in:
Marc Tamlyn
2014-03-14 17:34:49 +00:00
parent 5c517ec218
commit 36f514f065
22 changed files with 864 additions and 6 deletions

View File

@@ -133,3 +133,23 @@ SplitArrayField
['1', '2', ''] # -> [1, 2]
['1', '', '3'] # -> [1, None, 3]
['', '2', ''] # -> [None, 2]
HStoreField
-----------
.. 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>``.
.. admonition:: User friendly forms
``HStoreField`` is not particularly user friendly in most cases,
however it is a useful way to format data from a client-side widget for
submission to the server.
.. note::
On occasions it may be useful to require or restrict the keys which are
valid for a given field. This can be done using the
:class:`~django.contrib.postgres.validators.KeysValidator`.