Skip to content

Commit f1ef30d

Browse files
committed
refactor(relations): reorder args in RelatedField
1 parent fd9909a commit f1ef30d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rest_framework-stubs/relations.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class RelatedField(Field[_MT, _DT, _PT, Any]):
3838
def __init__(
3939
self,
4040
*,
41-
many: bool = ...,
42-
allow_empty: bool = ...,
4341
queryset: QuerySet[_MT] | Manager[_MT] | None = ...,
4442
html_cutoff: int | None = ...,
4543
html_cutoff_text: str = ...,
44+
many: bool = ...,
45+
allow_empty: bool = ...,
4646
read_only: bool = ...,
4747
write_only: bool = ...,
4848
required: bool | None = None,
@@ -51,24 +51,24 @@ class RelatedField(Field[_MT, _DT, _PT, Any]):
5151
source: str | None = None,
5252
label: StrOrPromise | None = ...,
5353
help_text: StrOrPromise | None = None,
54-
allow_null: bool = ...,
55-
validators: Sequence[Validator[_MT]] | None = ...,
56-
error_messages: dict[str, StrOrPromise] | None = ...,
5754
style: dict[str, str] | None = ...,
55+
error_messages: dict[str, StrOrPromise] | None = ...,
56+
validators: Sequence[Validator[_MT]] | None = ...,
57+
allow_null: bool = ...,
5858
) -> None: ...
5959
# mypy doesn't accept the typing below, although its accurate to what this class is doing, hence the ignore
6060
def __new__(cls, *args: Any, **kwargs: Any) -> RelatedField[_MT, _DT, _PT] | ManyRelatedField: ... # type: ignore
6161
@classmethod
6262
def many_init(cls, *args: Any, **kwargs: Any) -> ManyRelatedField: ...
6363
def get_queryset(self) -> QuerySet[_MT]: ...
6464
def use_pk_only_optimization(self) -> bool: ...
65+
def get_attribute(self, instance: _MT) -> _PT | None: ...
6566
def get_choices(self, cutoff: int | None = ...) -> dict: ...
6667
@property
6768
def choices(self) -> dict: ...
6869
@property
6970
def grouped_choices(self) -> dict: ...
7071
def iter_options(self) -> Iterable[Option]: ...
71-
def get_attribute(self, instance: _MT) -> _PT | None: ...
7272
def display_value(self, instance: _MT) -> str: ...
7373

7474
class StringRelatedField(RelatedField[_MT, _MT, str]): ...

0 commit comments

Comments
 (0)