Opened 22 months ago
Closed 22 months ago
#34421 closed Bug (fixed)
QuerySet.update() on querysets in descending order by annotations.
Reported by: | WE1 | Owned by: | WE1 |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.1 |
Severity: | Normal | Keywords: | update, order_by |
Cc: | 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
When I execute
Model.objects.annotate(message_length=Length('message')).order_by('-message_length').update(text="Can I come on board?")
I get the error
FieldError: Cannot resolve keyword 'message_length' into field. Choices are: message, id, text, x
because the code ignores the descending case.
Change History (3)
comment:1 by , 22 months ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 22 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
PR