Improve admin filter types (#984)

This commit is contained in:
Adam Johnson
2022-06-07 10:29:44 +01:00
committed by GitHub
parent 195aaad1fe
commit 13c09921f8

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type
from django.contrib.admin.options import ModelAdmin from django.contrib.admin.options import ModelAdmin
from django.db.models.base import Model from django.db.models.base import Model
@@ -16,14 +16,14 @@ class ListFilter:
) -> None: ... ) -> None: ...
def has_output(self) -> bool: ... def has_output(self) -> bool: ...
def choices(self, changelist: Any) -> Iterator[Dict[str, Any]]: ... def choices(self, changelist: Any) -> Iterator[Dict[str, Any]]: ...
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ... def queryset(self, request: HttpRequest, queryset: QuerySet) -> Optional[QuerySet]: ...
def expected_parameters(self) -> Optional[List[str]]: ... def expected_parameters(self) -> Optional[List[str]]: ...
class SimpleListFilter(ListFilter): class SimpleListFilter(ListFilter):
parameter_name: str = ... parameter_name: str = ...
lookup_choices: Any = ... lookup_choices: Any = ...
def value(self) -> Optional[str]: ... def value(self) -> Optional[str]: ...
def lookups(self, request: Any, model_admin: Any) -> List[Tuple[Any, str]]: ... def lookups(self, request: HttpRequest, model_admin: ModelAdmin) -> Iterable[Tuple[Any, str]]: ...
def choices(self, changelist: Any) -> Iterator[Dict[str, Any]]: ... def choices(self, changelist: Any) -> Iterator[Dict[str, Any]]: ...
class FieldListFilter(ListFilter): class FieldListFilter(ListFilter):