django icon indicating copy to clipboard operation
django copied to clipboard

Fixed #33918 #25705 __str__ method in Query object wraps strings in quotation marks

Open johniak opened this issue 1 year ago • 2 comments

When executing str on django.db.models.sql.query.Query objects, string parameters will be wrapped in single quotation marks.

For example:

str(Article.objects.filter(headline="", id=1).values("id").query)

returns

SELECT "backends_article"."id" FROM "backends_article" WHERE ("backends_article"."headline" = '' AND "backends_article"."id" = 1)

johniak avatar Aug 11 '22 18:08 johniak

@johniak Thanks for this patch :+1: , however it's more complicated, see e.g. #12156.

felixxm avatar Aug 11 '22 18:08 felixxm

@felixxm thanks for your comment, I modified PR. I added support for ranges, and tests pass through all pipelines

johniak avatar Aug 12 '22 16:08 johniak