1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #33872 -- Deprecated django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.

This commit is contained in:
Mariusz Felisiak
2022-08-03 11:42:51 +02:00
committed by GitHub
parent 09e837c5d9
commit cb791a2540
15 changed files with 228 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
# RemovedInDjango51Warning.
"""
The citext PostgreSQL extension supports indexing of case-insensitive text
strings and thus eliminates the need for operations such as iexact and other
@@ -5,6 +6,7 @@ modifiers to enforce use of an index.
"""
from django.db import IntegrityError
from django.test.utils import modify_settings
from django.utils.deprecation import RemovedInDjango51Warning
from . import PostgreSQLTestCase
from .models import CITestModel
@@ -82,3 +84,10 @@ class CITextTestCase(PostgreSQLTestCase):
self.assertSequenceEqual(
CITestModel.objects.filter(**query), [self.john]
)
def test_citext_deprecated(self):
from django.contrib.postgres.fields import CIText
msg = "django.contrib.postgres.fields.CIText mixin is deprecated."
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
CIText()