Changeset 3552
- Timestamp:
- 08/11/06 00:20:31 (2 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/db/models/fields/__init__.py (modified) (1 diff)
- django/trunk/tests/modeltests/lookup/models.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r3549 r3552 126 126 David Schein 127 127 sopel 128 Thomas Steinacher <tom@eggdrop.ch> 128 129 Radek Å varz <http://www.svarz.cz/translate/> 129 130 Swaroop C H <http://www.swaroopch.info> django/trunk/django/db/models/fields/__init__.py
r3508 r3552 21 21 22 22 # prepares a value for use in a LIKE query 23 prep_for_like_query = lambda x: str(x).replace(" %", "\%").replace("_", "\_")23 prep_for_like_query = lambda x: str(x).replace("\\", "\\\\").replace("%", "\%").replace("_", "\_") 24 24 25 25 # returns the <ul> class for a given radio_admin value django/trunk/tests/modeltests/lookup/models.py
r3223 r3552 16 16 return self.headline 17 17 18 API_TESTS = """18 API_TESTS = r""" 19 19 # Create a couple of Articles. 20 20 >>> from datetime import datetime … … 162 162 163 163 # Underscores and percent signs have special meaning in the underlying 164 # database library, but Django handles the quoting of them automatically.164 # SQL code, but Django handles the quoting of them automatically. 165 165 >>> a8 = Article(headline='Article_ with underscore', pub_date=datetime(2005, 11, 20)) 166 166 >>> a8.save() … … 169 169 >>> Article.objects.filter(headline__startswith='Article_') 170 170 [<Article: Article_ with underscore>] 171 171 172 >>> a9 = Article(headline='Article% with percent sign', pub_date=datetime(2005, 11, 21)) 172 173 >>> a9.save() … … 183 184 >>> Article.objects.exclude(headline="Article 7") 184 185 [<Article: Article% with percent sign>, <Article: Article_ with underscore>, <Article: Article 5>, <Article: Article 6>, <Article: Article 4>, <Article: Article 2>, <Article: Article 3>, <Article: Article 1>] 186 187 # Backslashes also have special meaning in the underlying SQL code, but Django 188 # automatically quotes them appropriately. 189 >>> a10 = Article(headline='Article with \\ backslash', pub_date=datetime(2005, 11, 22)) 190 >>> a10.save() 191 >>> Article.objects.filter(headline__contains='\\') 192 [<Article: Article with \ backslash>] 193 185 194 """
