@@ -38,11 +38,11 @@ class RelatedField(Field[_MT, _DT, _PT, Any]):
38
38
def __init__ (
39
39
self ,
40
40
* ,
41
- many : bool = ...,
42
- allow_empty : bool = ...,
43
41
queryset : QuerySet [_MT ] | Manager [_MT ] | None = ...,
44
42
html_cutoff : int | None = ...,
45
43
html_cutoff_text : str = ...,
44
+ many : bool = ...,
45
+ allow_empty : bool = ...,
46
46
read_only : bool = ...,
47
47
write_only : bool = ...,
48
48
required : bool | None = None ,
@@ -51,24 +51,24 @@ class RelatedField(Field[_MT, _DT, _PT, Any]):
51
51
source : str | None = None ,
52
52
label : StrOrPromise | None = ...,
53
53
help_text : StrOrPromise | None = None ,
54
- allow_null : bool = ...,
55
- validators : Sequence [Validator [_MT ]] | None = ...,
56
- error_messages : dict [str , StrOrPromise ] | None = ...,
57
54
style : dict [str , str ] | None = ...,
55
+ error_messages : dict [str , StrOrPromise ] | None = ...,
56
+ validators : Sequence [Validator [_MT ]] | None = ...,
57
+ allow_null : bool = ...,
58
58
) -> None : ...
59
59
# mypy doesn't accept the typing below, although its accurate to what this class is doing, hence the ignore
60
60
def __new__ (cls , * args : Any , ** kwargs : Any ) -> RelatedField [_MT , _DT , _PT ] | ManyRelatedField : ... # type: ignore
61
61
@classmethod
62
62
def many_init (cls , * args : Any , ** kwargs : Any ) -> ManyRelatedField : ...
63
63
def get_queryset (self ) -> QuerySet [_MT ]: ...
64
64
def use_pk_only_optimization (self ) -> bool : ...
65
+ def get_attribute (self , instance : _MT ) -> _PT | None : ...
65
66
def get_choices (self , cutoff : int | None = ...) -> dict : ...
66
67
@property
67
68
def choices (self ) -> dict : ...
68
69
@property
69
70
def grouped_choices (self ) -> dict : ...
70
71
def iter_options (self ) -> Iterable [Option ]: ...
71
- def get_attribute (self , instance : _MT ) -> _PT | None : ...
72
72
def display_value (self , instance : _MT ) -> str : ...
73
73
74
74
class StringRelatedField (RelatedField [_MT , _MT , str ]): ...
0 commit comments