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 #30449 -- Fixed RelatedFieldListFilter/RelatedOnlyFieldListFilter to respect model's Meta.ordering. #11400
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.
Minor comments around checking the existence of ordering
before applying it on the QuerySet in get_choices
.
PS: Please forgive my naivety if it seems like that. It's my first review on the Django project.
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.
@zeyneloz Thanks for this patch 👍 I left some comment. Can you also split your changes into two commits
- 1st with adding
get_field_ordering()
hook, and - 2nd with fix and tests.
@felixxm Thanks for the comments. I tried to avoid adding extra models for tests but I had to add two new ones otherwise it would have broken existing test cases. Can you review the new commits, If everything is okay, I can revamp the commits then. |
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.
Thanks @felixxm . I added the release note. |
@zeyneloz Thanks! I changed tests and moved a regression fix to a separate commit. |
…er to respect model's Meta.ordering. Regression in 6d4e5fe. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Check #30449
Refactored admin.RelatedFieldListFilter and admin.RelatedOnlyFieldListFilter
to respect ordering defined in related model admin. Refactored
Field.get_choices to fallback to default model ordering.