#33918 closed Bug (duplicate)

__str__ method in Query object not wrapping strings in quotation marks

Reported by: Jan Romaniak Owned by: Jan Romaniak
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jan Romaniak)

When executing str on django.db.models.sql.query.Query objects, string parameters are not 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)

which is invalid SQL

Change History (2)

comment:1 by Jan Romaniak, 19 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 19 months ago

Easy pickings: unset
Resolution: duplicate
Status: assignedclosed

Duplicate of #25705 (see comment).

Note: See TracTickets for help on using tickets.
Back to Top