mirror of https://github.com/django/django.git
Refs #12990 -- Removed django.contrib.postgres.forms.JSONField per deprecation timeline.
This commit is contained in:
parent
8fdb5a656a
commit
2dd6a83d2d
|
@ -1,4 +1,3 @@
|
|||
from .array import * # NOQA
|
||||
from .hstore import * # NOQA
|
||||
from .jsonb import * # NOQA
|
||||
from .ranges import * # NOQA
|
||||
|
|
|
@ -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)
|
|
@ -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
|
||||
------------
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue