Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/django-filter/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "26.1.*"
upstream-repository = "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/carltongibson/django-filter/"
dependencies = ["django-stubs"]
dependencies = ["django-stubs>=6.0.8"]

[tool.stubtest]
mypy-plugins = ["mypy_django_plugin.main"]
Expand Down
7 changes: 5 additions & 2 deletions stubs/django-filter/django_filters/fields.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from _typeshed import Unused
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import Any, NamedTuple, TypeAlias
from typing import Any, NamedTuple, TypeAlias, TypeVar

from django import forms
from django.db.models import Choices
from django.db.models.base import Model
from django.forms import Widget
from django_stubs_ext import StrOrPromise

Expand All @@ -27,6 +28,8 @@ _Choices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup]
_ChoicesMapping: TypeAlias = Mapping[Any, Any]
_ChoicesInput: TypeAlias = _Choices | _ChoicesMapping | type[Choices] | Callable[[], _Choices | _ChoicesMapping]

_M = TypeVar("_M", bound=Model)

class RangeField(forms.MultiValueField):
widget: _ClassLevelWidget = ...
def __init__(
Expand Down Expand Up @@ -111,7 +114,7 @@ class ChoiceIterator:
def __iter__(self) -> Any: ... # Iterator yields choice tuples with any value types
def __len__(self) -> int: ...

class ModelChoiceIterator(forms.models.ModelChoiceIterator):
class ModelChoiceIterator(forms.models.ModelChoiceIterator[_M]):
def __iter__(self) -> Any: ... # Iterator yields choice tuples with any value types
def __len__(self) -> int: ...

Expand Down