浏览代码

Refs #12990 -- Removed django.contrib.postgres.forms.JSONField per deprecation timeline.

Mariusz Felisiak 4 年之前
父节点
当前提交
2dd6a83d2d

+ 0 - 1
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

+ 0 - 16
django/contrib/postgres/forms/jsonb.py

@@ -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)

+ 0 - 19
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
 ------------
 

+ 2 - 0
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.

+ 0 - 18
tests/postgres_tests/test_json_deprecation.py

@@ -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()