mirror of https://github.com/django/django.git
Thanks Harris Lapiroff for the report.
This commit is contained in:
parent
8516f7c49b
commit
d976760260
|
@ -133,6 +133,10 @@ class KeyTransformTextLookupMixin(object):
|
|||
super(KeyTransformTextLookupMixin, self).__init__(key_text_transform, *args, **kwargs)
|
||||
|
||||
|
||||
class KeyTransformIExact(KeyTransformTextLookupMixin, builtin_lookups.IExact):
|
||||
pass
|
||||
|
||||
|
||||
class KeyTransformIContains(KeyTransformTextLookupMixin, builtin_lookups.IContains):
|
||||
pass
|
||||
|
||||
|
@ -161,6 +165,7 @@ class KeyTransformIRegex(KeyTransformTextLookupMixin, builtin_lookups.IRegex):
|
|||
pass
|
||||
|
||||
|
||||
KeyTransform.register_lookup(KeyTransformIExact)
|
||||
KeyTransform.register_lookup(KeyTransformIContains)
|
||||
KeyTransform.register_lookup(KeyTransformStartsWith)
|
||||
KeyTransform.register_lookup(KeyTransformIStartsWith)
|
||||
|
|
|
@ -238,6 +238,10 @@ class TestQuerying(PostgreSQLTestCase):
|
|||
self.objs[7:9]
|
||||
)
|
||||
|
||||
def test_iexact(self):
|
||||
self.assertTrue(JSONModel.objects.filter(field__foo__iexact='BaR').exists())
|
||||
self.assertFalse(JSONModel.objects.filter(field__foo__iexact='"BaR"').exists())
|
||||
|
||||
def test_icontains(self):
|
||||
self.assertFalse(JSONModel.objects.filter(field__foo__icontains='"bar"').exists())
|
||||
|
||||
|
|
Loading…
Reference in New Issue