Opened 2 years ago

Last modified 2 years ago

#33918 closed Bug

__str__ method in Query object not wrapping strings in quotation marks — at Initial Version

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

When executing str on django.db.models.sql.query.Query 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 (0)

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