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 #30463 -- Fixed crash of deprecation message when Meta.ordering contains expressions. #11377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruchit2801 Thanks for this patch 👍 . Please add release notes (2.2.2
) and a regression test (tests/ordering
). Changing ordering for Article
model e.g.
ordering = (
'-pub_date',
'headline',
models.F('author__name').asc(),
OrderBy(models.F('second_author__name')), )
and fixing ordering.tests.OrderingTests.test_deprecated_values_annotate
should be enough.
@felixxm I've made relevant changes. Can you give me a little hint, on how can I reproduce this error?
Thanks for the help :) |
@ruchit2801 I described this in a previous comment, it is also in ticket comments. You can change ordering = (
'-pub_date',
'headline',
models.F('author__name').asc(),
OrderBy(models.F('second_author__name')),
) after that you will get an error when running |
5504590
to
a337f19
Compare
@felixxm Changes pushed :). The failed check seems due to some unknown module |
… contains expressions. Regression in 1b1f64e.
@ruchit2801 Thanks again 🚀 |
This solves the error raised when
self._meta_ordering
encountered OrderBy instances in.join()
function. I've used regex function and python replace method to convert the string such that quotation marks are at the desired place and, the string remains in the form of real source code compatible withorder_by()
.I'd appreciate any cleaner solution than this one and would be happy to improve the code.