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

Merge pull request #1160 from erikr/host-inet-postgres2

Fixed #11442 -- Postgresql backend casts all inet types to text
This commit is contained in:
Aymeric Augustin
2013-05-19 04:57:10 -07:00
5 changed files with 16 additions and 12 deletions

View File

@@ -73,9 +73,11 @@ class StringLookupTests(TestCase):
"""
Regression test for #708
"like" queries on IP address fields require casting to text (on PostgreSQL).
"like" queries on IP address fields require casting with HOST() (on PostgreSQL).
"""
a = Article(name='IP test', text='The body', submitted_from='192.0.2.100')
a.save()
self.assertEqual(repr(Article.objects.filter(submitted_from__contains='192.0.2')),
repr([a]))
# Test that the searches do not match the subnet mask (/32 in this case)
self.assertEqual(Article.objects.filter(submitted_from__contains='32').count(), 0)