summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/testapp/models/lookup.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testapp/models/lookup.py b/tests/testapp/models/lookup.py
index 6d8ede1905..f8445c4f60 100644
--- a/tests/testapp/models/lookup.py
+++ b/tests/testapp/models/lookup.py
@@ -122,4 +122,19 @@ Article 7
Article 2
>>> a2.get_previous_by_pub_date()
Article 1
+
+# Underscores and percent signs have special meaning in the underlying
+# database library, but Django handles the quoting of them automatically.
+>>> a8 = articles.Article(headline='Article_ with underscore', pub_date=datetime(2005, 11, 20))
+>>> a8.save()
+>>> articles.get_list(headline__startswith='Article')
+[Article_ with underscore, Article 5, Article 6, Article 4, Article 2, Article 3, Article 7, Article 1]
+>>> articles.get_list(headline__startswith='Article_')
+[Article_ with underscore]
+>>> a9 = articles.Article(headline='Article% with percent sign', pub_date=datetime(2005, 11, 21))
+>>> a9.save()
+>>> articles.get_list(headline__startswith='Article')
+[Article% with percent sign, Article_ with underscore, Article 5, Article 6, Article 4, Article 2, Article 3, Article 7, Article 1]
+>>> articles.get_list(headline__startswith='Article%')
+[Article% with percent sign]
"""