From a2c34cc1d0a23369a7ec03f460c4ee48227cd219 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 13:57:31 +0200 Subject: [PATCH] [django-filter] Improve stubtest comment (#14738) --- stubs/django-filter/@tests/stubtest_allowlist.txt | 3 +-- stubs/django-filter/django_filters/filters.pyi | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stubs/django-filter/@tests/stubtest_allowlist.txt b/stubs/django-filter/@tests/stubtest_allowlist.txt index c07147364..d52e9f9f9 100644 --- a/stubs/django-filter/@tests/stubtest_allowlist.txt +++ b/stubs/django-filter/@tests/stubtest_allowlist.txt @@ -15,6 +15,5 @@ django_filters.fields.RangeField.__init__ django_filters.filters.QuerySetRequestMixin.__init__ django_filters.widgets.CSVWidget.__init__ -# FIXME: new stubtest errors from mypy v1.18.1 that need to be looked at more closely. -# See https://github.com/python/typeshed/pull/14699 +# BaseCSVFilter constructs a custom class dynamically, which stubtest can't handle. django_filters(\.\w+)*\.OrderingFilter.field_class diff --git a/stubs/django-filter/django_filters/filters.pyi b/stubs/django-filter/django_filters/filters.pyi index db6faefc2..ecceefd53 100644 --- a/stubs/django-filter/django_filters/filters.pyi +++ b/stubs/django-filter/django_filters/filters.pyi @@ -292,7 +292,10 @@ class LookupChoiceFilter(Filter): def filter(self, qs: QuerySet[Any], lookup: Lookup) -> QuerySet[Any]: ... class OrderingFilter(BaseCSVFilter, ChoiceFilter): - field_class: type[BaseCSVField] # Inherits CSV field behavior for comma-separated ordering + # Inherits CSV field behavior for comma-separated ordering. + # BaseCSVFilter constructs a custom ConcreteCSVField class that derives + # from BaseCSVField. + field_class: type[BaseCSVField] descending_fmt: str param_map: dict[str, str] | None def __init__(