@@ -293,21 +293,6 @@ class SoftDeletableManager(SoftDeletableManagerMixin, models.Manager):
293
293
294
294
class JoinQueryset (models .QuerySet ):
295
295
296
- def get_quoted_query (self , query ):
297
- query , params = query .sql_with_params ()
298
-
299
- # Put additional quotes around string.
300
- params = [
301
- f'\' { p } \' '
302
- if isinstance (p , str ) else p
303
- for p in params
304
- ]
305
-
306
- # Cast list of parameters to tuple because I got
307
- # "not enough format characters" otherwise.
308
- params = tuple (params )
309
- return query % params
310
-
311
296
def join (self , qs = None ):
312
297
'''
313
298
Join one queryset together with another using a temporary table. If
@@ -349,7 +334,7 @@ def join(self, qs=None):
349
334
new_qs = self .model .objects .all ()
350
335
351
336
TABLE_NAME = 'temp_stuff'
352
- query = self . get_quoted_query ( qs .query )
337
+ query , params = qs .query . sql_with_params ( )
353
338
sql = '''
354
339
DROP TABLE IF EXISTS {table_name};
355
340
DROP INDEX IF EXISTS {table_name}_id;
@@ -358,7 +343,7 @@ def join(self, qs=None):
358
343
''' .format (table_name = TABLE_NAME , fk_column = fk_column , query = str (query ))
359
344
360
345
with connection .cursor () as cursor :
361
- cursor .execute (sql )
346
+ cursor .execute (sql , params )
362
347
363
348
class TempModel (models .Model ):
364
349
temp_key = models .ForeignKey (
0 commit comments