Skip to content

Conversation

@smelnikov
Copy link
Contributor

The type annotation for the fields parameter in OrderingFilter was incomplete.

According to the documentation:
https://django-filter.readthedocs.io/en/stable/ref/filters.html#django_filters.filters.OrderingFilter

fields is a mapping of {model field name: parameter name}. The parameter names are exposed in the choices and mask/alias the field names used in the order_by() call. Similar to field choices, fields accepts the ‘list of two-tuples’ syntax that retains order. fields may also just be an iterable of strings. In this case, the field names simply double as the exposed parameter names.

https://github.com/carltongibson/django-filter/blob/17ec565554bea4119ad74d2ffccdfb9740d9845b/django_filters/filters.py#L799-L800

Notes

The incorrect type has been present since commit 893b9a7, affecting versions starting from types-django-filter==25.1.0.20250815.

If possible, guidance on how to submit a backport PR for an older stub version would be appreciated.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, unfortunately, typeshed doesn't support backporting changes to older stub versions.

@srittau srittau merged commit 21f3e4c into python:main Oct 9, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants