-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by annotations. #16657
Fixed #34421 -- Fixed QuerySet.update() on querysets in descending order by annotations. #16657
Conversation
@felixxm, not sure how we want to treat this one. It's clearly a case missed by #15747 / ticket-28897 which is part of 4.2 but with and without the patch the test fails with the same signature
So it's technically not a regression but certainly a bug in newly introduced feature that allows |
ticket-28897 is classified as a bug (not a new feature) and #15747 is a bugfix so I don't think it's a release blocker for Django 4.2 🤔 |
... but I'm happy to backport it, if we will have a reasonable patch before Monday. |
yeah I'm on the fence as well, whatever works best here. |
I noticed that 3ef37a5 was backported to Django 4.1 (in alpha) so it definitely doesn't qualify for a backport. I'd treat it as a separate bug. @HB6H057 Can you create a new ticket in Trac? All bugfixes require an accepted ticket. |
@felixxm I created a ticket and added the tests to the list of skipped tests, but now I have a little problem with the suggestion. Please see if there are any other problems, thanks. |
fc780a3
to
99b2d33
Compare
@HB6H057 Thanks for updates 👍 Welcome aboard ⛵ I pushed small edits. |
@felixxm Hi, it occurred to me that you used the new python 3.9 feature |
On the |
…der by annotations.
99b2d33
to
2ffa815
Compare
I often use admin to manage data, so I wrote an action to update data in bulk, but sometimes it reports an error
FieldError: Cannot resolve keyword 'message_length' into field. Choices are: message, id, text, x
And the error is reported in descending order, similar to the execution of the following query statement
Model.objects.annotate(message_length=Length('message')).order_by('-message_length').update(text="Can I come on board?")
Through debug found that the programmer ignored the case of descending order, so wrote this patch to fix the problem, see the code for more details.
First submission, so if there are any questions please guide me.