Skip to content

Commit 0dc8b42

Browse files
authored
represent choices in ChoiceField as Sequence (#686)
this enforces that choices are in a deterministic order for forms / schemas / etc.
1 parent 13a2404 commit 0dc8b42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework-stubs/fields.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ class ChoiceField(Field[str, str | int | tuple[str | int, str | int | tuple], st
463463
_choices: dict
464464
def __init__(
465465
self,
466-
choices: Iterable[Any],
466+
choices: Sequence[Any],
467467
*,
468468
read_only: bool = ...,
469469
write_only: bool = ...,
@@ -499,7 +499,7 @@ class MultipleChoiceField(
499499
def __init__(
500500
self,
501501
*,
502-
choices: Iterable[Any],
502+
choices: Sequence[Any],
503503
read_only: bool = ...,
504504
write_only: bool = ...,
505505
required: bool | None = None,

0 commit comments

Comments
 (0)