Skip to content

Commit 474ceb3

Browse files
committed
Add more attribute to fields
1 parent 85547a8 commit 474ceb3

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

rest_framework-stubs/fields.pyi

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,20 @@ class Field:
5454
default_validators: List[Callable] = ...
5555
default_empty_html: Any = ...
5656
initial: Optional[Any] = ...
57+
read_only: bool = ...
58+
write_only: bool = ...
59+
required: bool = ...
60+
default: Any = ...
61+
source: Optional[Union[Callable, str]] = ...
62+
label: Optional[str] = ...
63+
help_text: Optional[str] = ...
64+
style: Optional[Mapping[str, Any]] = ...
65+
error_messages: Optional[Mapping[str, str]] = ...
66+
validators: Optional[List[_Validator]] = ...
67+
allow_null: bool = ...
68+
field_name: Optional[str] = ...
5769
# TODO: add Generic/Plugin support for parent
58-
parent: Optional[Any]
59-
validators: Optional[List[_Validator]]
70+
parent: Optional[Any] = ...
6071
def __init__(
6172
self,
6273
read_only: bool = ...,
@@ -67,10 +78,10 @@ class Field:
6778
source: Union[Callable, str] = ...,
6879
label: Optional[str] = ...,
6980
help_text: str = ...,
70-
allow_null: bool = ...,
71-
validators: Optional[Sequence[_Validator]] = ...,
72-
error_messages: Optional[Mapping[str, str]] = ...,
7381
style: Optional[Mapping[str, Any]] = ...,
82+
error_messages: Optional[Mapping[str, str]] = ...,
83+
validators: Optional[Sequence[_Validator]] = ...,
84+
allow_null: bool = ...,
7485
): ...
7586
def bind(self, field_name: str, parent: BaseSerializer) -> None: ...
7687
def get_validators(self) -> List[Callable]: ...
@@ -102,6 +113,7 @@ class NullBooleanField(Field):
102113
class CharField(Field):
103114
_pyi_field_actual_type: str
104115
_pyi_field_primitive_type: str
116+
allow_blank: bool = ...
105117
def __init__(
106118
self,
107119
read_only: bool = ...,
@@ -387,6 +399,7 @@ class ChoiceField(Field):
387399
choices: Sequence[Any]
388400
html_cutoff: Optional[int] = ...
389401
html_cutoff_text: Optional[str] = ...
402+
allow_blank: bool = ...
390403
def __init__(
391404
self,
392405
choices: Sequence[Any],
@@ -411,6 +424,7 @@ class ChoiceField(Field):
411424
def _set_choices(self, choices: Sequence[Any]) -> None: ...
412425

413426
class MultipleChoiceField(ChoiceField):
427+
allow_empty: bool = ...
414428
def __init__(
415429
self,
416430
choices: Sequence[Any],
@@ -482,6 +496,7 @@ class SupportsToPython(Protocol):
482496

483497
class ImageField(FileField):
484498
_DjangoImageField: SupportsToPython
499+
allow_empty: bool = ...
485500
def __init__(
486501
self,
487502
_DjangoImageField: Type[SupportsToPython] = ...,

0 commit comments

Comments
 (0)