mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #12990 -- Removed django.contrib.postgres.fields.JSONField per deprecation timeline.
This commit is contained in:
parent
98ae3925e5
commit
7cb5712edc
21 changed files with 45 additions and 93 deletions
|
@ -1,35 +1,17 @@
|
|||
try:
|
||||
from django.contrib.postgres import forms
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.contrib.postgres.fields.jsonb import (
|
||||
KeyTextTransform, KeyTransform,
|
||||
)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from django.core.checks import Warning as DjangoWarning
|
||||
from django.utils.deprecation import RemovedInDjango40Warning
|
||||
|
||||
from . import PostgreSQLSimpleTestCase
|
||||
from .models import PostgreSQLModel
|
||||
|
||||
|
||||
class DeprecationTests(PostgreSQLSimpleTestCase):
|
||||
def test_model_field_deprecation_message(self):
|
||||
class PostgreSQLJSONModel(PostgreSQLModel):
|
||||
field = JSONField()
|
||||
|
||||
self.assertEqual(PostgreSQLJSONModel().check(), [
|
||||
DjangoWarning(
|
||||
'django.contrib.postgres.fields.JSONField is deprecated. '
|
||||
'Support for it (except in historical migrations) will be '
|
||||
'removed in Django 4.0.',
|
||||
hint='Use django.db.models.JSONField instead.',
|
||||
obj=PostgreSQLJSONModel._meta.get_field('field'),
|
||||
id='fields.W904',
|
||||
),
|
||||
])
|
||||
|
||||
def test_form_field_deprecation_message(self):
|
||||
msg = (
|
||||
'django.contrib.postgres.forms.JSONField is deprecated in favor '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue