Opened 13 years ago
Last modified 10 years ago
#16731 closed Bug
startswith and contains doesn't work with F expression — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | startswith, F(), wildcards |
Cc: | Koen Vossen | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The expression:
myTable.objects.filter(field1startswith=F('field2'))
rendered to:
SELECT * FROM my_table
WHERE my_table
.field1
LIKE my_table
.field2
should be:
SELECT * FROM my_table
WHERE my_table
.field1
LIKE CONCAT(my_table
.field2
,'%')
Note:
See TracTickets
for help on using tickets.