mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 13:35:01 +08:00
Fix type of update_fields parameter to Model.save (#437)
Sending in a single string leads to unexpected behavior and the method accepts any iterable, not just sequences, of strings. Technically sending in a single string is still allowed because a string is an iterable of strings, but this way the intention of that argument is clearer.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Collection
|
||||
from typing import Any, Callable, Collection, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union
|
||||
|
||||
from django.core.checks.messages import CheckMessage
|
||||
from django.core.exceptions import ValidationError
|
||||
@@ -43,7 +43,7 @@ class Model(metaclass=ModelBase):
|
||||
force_insert: bool = ...,
|
||||
force_update: bool = ...,
|
||||
using: Optional[str] = ...,
|
||||
update_fields: Optional[Union[Sequence[str], str]] = ...,
|
||||
update_fields: Optional[Iterable[str]] = ...,
|
||||
) -> None: ...
|
||||
def save_base(
|
||||
self,
|
||||
@@ -51,7 +51,7 @@ class Model(metaclass=ModelBase):
|
||||
force_insert: bool = ...,
|
||||
force_update: bool = ...,
|
||||
using: Optional[str] = ...,
|
||||
update_fields: Optional[Union[Sequence[str], str]] = ...,
|
||||
update_fields: Optional[Iterable[str]] = ...,
|
||||
): ...
|
||||
def refresh_from_db(self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ...) -> None: ...
|
||||
def get_deferred_fields(self) -> Set[str]: ...
|
||||
|
||||
Reference in New Issue
Block a user