diff options
| author | Tom Forbes <tom@tomforb.es> | 2020-06-30 23:23:51 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-03 12:58:33 +0200 |
| commit | 7598ba01aa2b0b48ac006aea6d218f77eb949061 (patch) | |
| tree | 321cee08dbd26c7eb86faa5dd55cc70c6beacf60 | |
| parent | 05206ca4ff685774ad20c96ca90a70f39a344fab (diff) | |
[3.1.x] Refs #12990 -- Added example to JSONField release notes.
Backport of 5d4b9c1cab03f0d057f0c7751862df0302c65cf9 from master
| -rw-r--r-- | docs/releases/3.1.txt | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index af7ec6fe5a..50eba75170 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -70,8 +70,25 @@ JSONField for all supported database backends Django now includes :class:`.models.JSONField` and :class:`forms.JSONField <django.forms.JSONField>` that can be used on all supported database backends. Both fields support the use of custom JSON -encoders and decoders. The model field supports the introspection, lookups, and -transforms that were previously PostgreSQL-only. +encoders and decoders. The model field supports the introspection, +:ref:`lookups, and transforms <querying-jsonfield>` that were previously +PostgreSQL-only:: + + from django.db import models + + class ContactInfo(models.Model): + data = models.JSONField() + + ContactInfo.objects.create(data={ + 'name': 'John', + 'cities': ['London', 'Cambridge'], + 'pets': {'dogs': ['Rufus', 'Meg']}, + }) + ContactInfo.objects.filter( + data__name='John', + data__pets__has_key='dogs', + data__cities__contains='London', + ).delete() If your project uses ``django.contrib.postgres.fields.JSONField``, plus the related form field and transforms, you should adjust to use the new fields, |
