summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-02-26 23:12:47 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-02-26 23:12:47 +0000
commita9b4efc82b23383038fed6da6ba97242aece27c1 (patch)
tree010ed247aae80929f701047a3a55f71d748a7290 /tests/regressiontests
parentf7fbc289ad7e13436f17939046cd1adfe438b126 (diff)
Re-enable substring lookups for IP address fields in Postgres using HOST() Thanks for the suggestion, Thomas Adamcik. Fixes #708.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/string_lookup/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/regressiontests/string_lookup/models.py b/tests/regressiontests/string_lookup/models.py
index 9deeb18763..1bdb2d4452 100644
--- a/tests/regressiontests/string_lookup/models.py
+++ b/tests/regressiontests/string_lookup/models.py
@@ -39,6 +39,7 @@ class Base(models.Model):
class Article(models.Model):
name = models.CharField(max_length=50)
text = models.TextField()
+ submitted_from = models.IPAddressField(blank=True, null=True)
def __str__(self):
return "Article %s" % self.name
@@ -98,4 +99,11 @@ __test__ = {'API_TESTS': ur"""
>>> Article.objects.get(text__contains='quick brown fox')
<Article: Article Test>
+
+# Regression test for #708: "like" queries on IP address fields require casting
+# to text (on PostgreSQL).
+>>> Article(name='IP test', text='The body', submitted_from='192.0.2.100').save()
+>>> Article.objects.filter(submitted_from__contains='192.0.2')
+[<Article: Article IP test>]
+
"""}