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:
@@ -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',
|
||||
),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user