From fb0908a4a240af893c11a727d2b74882e1423daf Mon Sep 17 00:00:00 2001 From: Pascal F Date: Tue, 5 Dec 2023 12:29:13 +0100 Subject: [PATCH] Added `Model._do_update()` method signature (#1854) Add typing for a private method (used in django-fsm), which signature has not changed since 2013. Co-authored-by: Marti Raudsepp --- django-stubs/db/models/base.pyi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index c4d48c928..0780af73c 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -4,7 +4,7 @@ from typing import Any, ClassVar, Final, TypeVar, overload from django.core.checks.messages import CheckMessage from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObjectsReturned from django.core.exceptions import ObjectDoesNotExist, ValidationError -from django.db.models import BaseConstraint, Field +from django.db.models import BaseConstraint, Field, QuerySet from django.db.models.manager import BaseManager, Manager from django.db.models.options import Options from typing_extensions import Self @@ -49,6 +49,15 @@ class Model(metaclass=ModelBase): def add_to_class(cls, name: str, value: Any) -> Any: ... @classmethod def from_db(cls, db: str | None, field_names: Collection[str], values: Collection[Any]) -> Self: ... + def _do_update( + self, + base_qs: QuerySet[Self], + using: str | None, + pk_val: Any, + values: Collection[tuple[Field, type[Model] | None, Any]], + update_fields: Iterable[str] | None, + forced_update: bool, + ) -> bool: ... def delete(self, using: Any = ..., keep_parents: bool = ...) -> tuple[int, dict[str, int]]: ... async def adelete(self, using: Any = ..., keep_parents: bool = ...) -> tuple[int, dict[str, int]]: ... def full_clean(