Skip to content

Commit d0f9730

Browse files
authored
Add db.models.fields.Field method stubs for custom Fields (#331)
Add stubs for: pre_save, get_db_prep_value, get_db_prep_save
1 parent 0fdd678 commit d0f9730

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

django-stubs/db/models/fields/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
108108
def set_attributes_from_name(self, name: str) -> None: ...
109109
def db_type(self, connection: Any) -> str: ...
110110
def db_parameters(self, connection: Any) -> Dict[str, str]: ...
111+
def pre_save(self, model_instance: Model, add: bool) -> Any: ...
111112
def get_prep_value(self, value: Any) -> Any: ...
113+
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool) -> Any: ...
114+
def get_db_prep_save(self, value: Any, connection: Any) -> Any: ...
112115
def get_internal_type(self) -> str: ...
113116
# TODO: plugin support
114117
def formfield(self, **kwargs) -> Any: ...

0 commit comments

Comments
 (0)