Opened 3 years ago
Closed 3 years ago
#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 )
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 , 3 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 3 years ago
| Easy pickings: | unset |
|---|---|
| Resolution: | → duplicate |
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #25705 (see comment).