Skip to content

Commit 01a2ed1

Browse files
committed
fix escaping of special characters in text lookups
1 parent 6a86eb1 commit 01a2ed1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.github/workflows/test-python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
basic
7171
empty
7272
from_db_value
73+
lookup.tests.LookupTests.test_escaping
7374
model_fields.test_datetimefield
7475
model_fields.test_decimalfield
7576
model_fields.test_charfield

django_mongodb/operations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def convert_uuidfield_value(self, value, expression, connection):
4848
value = uuid.UUID(value)
4949
return value
5050

51+
def prep_for_like_query(self, x):
52+
# Override value escaping for LIKE queries.
53+
return str(x)
54+
5155
def quote_name(self, name):
5256
if name.startswith('"') and name.endswith('"'):
5357
return name # Quoting once is enough.

0 commit comments

Comments
 (0)