1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

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

This commit is contained in:
Mariusz Felisiak
2021-01-14 09:33:12 +01:00
parent 98ae3925e5
commit 7cb5712edc
21 changed files with 45 additions and 93 deletions

View File

@@ -1,5 +1,7 @@
from unittest import skipUnless
from django.core import checks
from django.db import models
from django.db import connection, models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps
@@ -52,3 +54,20 @@ class DeprecatedFieldsTests(SimpleTestCase):
id='fields.E903',
),
])
@skipUnless(connection.vendor == 'postgresql', 'PostgreSQL specific SQL')
def test_postgres_jsonfield_deprecated(self):
from django.contrib.postgres.fields import JSONField
class PostgresJSONFieldModel(models.Model):
field = JSONField()
self.assertEqual(PostgresJSONFieldModel.check(), [
checks.Error(
'django.contrib.postgres.fields.JSONField is removed except '
'for support in historical migrations.',
hint='Use django.db.models.JSONField instead.',
obj=PostgresJSONFieldModel._meta.get_field('field'),
id='fields.E904',
),
])