summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-14 10:04:20 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-14 17:50:04 +0100
commit2dd6a83d2d7c61321ac4a9b10fbf3c379cb305c3 (patch)
tree3f87cb1b10dddce3ad43689e13cc8e42a9faec51
parent8fdb5a656a35dc9beef4cf2b79a782068263c7ec (diff)
Refs #12990 -- Removed django.contrib.postgres.forms.JSONField per deprecation timeline.
-rw-r--r--django/contrib/postgres/forms/__init__.py1
-rw-r--r--django/contrib/postgres/forms/jsonb.py16
-rw-r--r--docs/ref/contrib/postgres/forms.txt19
-rw-r--r--docs/releases/4.0.txt2
-rw-r--r--tests/postgres_tests/test_json_deprecation.py18
5 files changed, 2 insertions, 54 deletions
diff --git a/django/contrib/postgres/forms/__init__.py b/django/contrib/postgres/forms/__init__.py
index 9158f1e7cc..bb2685eca1 100644
--- a/django/contrib/postgres/forms/__init__.py
+++ b/django/contrib/postgres/forms/__init__.py
@@ -1,4 +1,3 @@
from .array import * # NOQA
from .hstore import * # NOQA
-from .jsonb import * # NOQA
from .ranges import * # NOQA
diff --git a/django/contrib/postgres/forms/jsonb.py b/django/contrib/postgres/forms/jsonb.py
deleted file mode 100644
index ebc85efa6f..0000000000
--- a/django/contrib/postgres/forms/jsonb.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import warnings
-
-from django.forms import JSONField as BuiltinJSONField
-from django.utils.deprecation import RemovedInDjango40Warning
-
-__all__ = ['JSONField']
-
-
-class JSONField(BuiltinJSONField):
- def __init__(self, *args, **kwargs):
- warnings.warn(
- 'django.contrib.postgres.forms.JSONField is deprecated in favor '
- 'of django.forms.JSONField.',
- RemovedInDjango40Warning, stacklevel=2,
- )
- super().__init__(*args, **kwargs)
diff --git a/docs/ref/contrib/postgres/forms.txt b/docs/ref/contrib/postgres/forms.txt
index 715b376ac9..e5d597655f 100644
--- a/docs/ref/contrib/postgres/forms.txt
+++ b/docs/ref/contrib/postgres/forms.txt
@@ -158,25 +158,6 @@ Fields
valid for a given field. This can be done using the
:class:`~django.contrib.postgres.validators.KeysValidator`.
-``JSONField``
--------------
-
-.. class:: JSONField
-
- A field which accepts JSON encoded data for a
- :class:`~django.db.models.JSONField`. It is represented by an HTML
- ``<textarea>``.
-
- .. admonition:: User friendly forms
-
- ``JSONField`` 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.
-
- .. deprecated:: 3.1
-
- Use :class:`django.forms.JSONField` instead.
-
Range Fields
------------
diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt
index ff14570063..c8b3f0332f 100644
--- a/docs/releases/4.0.txt
+++ b/docs/releases/4.0.txt
@@ -319,3 +319,5 @@ to remove usage of these features.
* ``django.contrib.postgres.fields.jsonb.KeyTransform`` and
``django.contrib.postgres.fields.jsonb.KeyTextTransform`` are removed.
+
+* ``django.contrib.postgres.forms.JSONField`` is removed.
diff --git a/tests/postgres_tests/test_json_deprecation.py b/tests/postgres_tests/test_json_deprecation.py
deleted file mode 100644
index d55b71efb0..0000000000
--- a/tests/postgres_tests/test_json_deprecation.py
+++ /dev/null
@@ -1,18 +0,0 @@
-try:
- from django.contrib.postgres import forms
-except ImportError:
- pass
-
-from django.utils.deprecation import RemovedInDjango40Warning
-
-from . import PostgreSQLSimpleTestCase
-
-
-class DeprecationTests(PostgreSQLSimpleTestCase):
- def test_form_field_deprecation_message(self):
- msg = (
- 'django.contrib.postgres.forms.JSONField is deprecated in favor '
- 'of django.forms.JSONField.'
- )
- with self.assertWarnsMessage(RemovedInDjango40Warning, msg):
- forms.JSONField()