Fixed #32231 -- Allowed passing None params to QuerySet.raw().

This commit is contained in:
Alexander Lyabah 2020-11-28 18:08:27 +02:00 committed by Mariusz Felisiak
parent aa3d360631
commit 415f50298f
5 changed files with 28 additions and 7 deletions

View file

@ -180,6 +180,11 @@ class RawQueryTests(TestCase):
self.assertEqual(len(results), 1)
self.assertIsInstance(repr(qset), str)
def test_params_none(self):
query = "SELECT * FROM raw_query_author WHERE first_name like 'J%'"
qset = Author.objects.raw(query, params=None)
self.assertEqual(len(qset), 2)
def test_escaped_percent(self):
query = "SELECT * FROM raw_query_author WHERE first_name like 'J%%'"
qset = Author.objects.raw(query)