mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
Set types for on_delete functions (#772)
Set types for on_delete functions so they can be provided as values to the on_delete attribute of ForeignKey in Pyright's strict mode.
This commit is contained in:
@@ -4,14 +4,45 @@ from django.db import IntegrityError
|
|||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
def CASCADE(collector, field, sub_objs, using): ...
|
def CASCADE(
|
||||||
def SET_NULL(collector, field, sub_objs, using): ...
|
collector: "Collector",
|
||||||
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
field: Field[Any, Any],
|
||||||
def DO_NOTHING(collector, field, sub_objs, using): ...
|
sub_objs: QuerySet[Model],
|
||||||
def PROTECT(collector, field, sub_objs, using): ...
|
using: str,
|
||||||
def RESTRICT(collector, field, sub_objs, using): ...
|
) -> None: ...
|
||||||
def SET(value: Any) -> Callable: ...
|
def SET_NULL(
|
||||||
|
collector: "Collector",
|
||||||
|
field: Field[Any, Any],
|
||||||
|
sub_objs: QuerySet[Model],
|
||||||
|
using: str,
|
||||||
|
) -> None: ...
|
||||||
|
def SET_DEFAULT(
|
||||||
|
collector: "Collector",
|
||||||
|
field: Field[Any, Any],
|
||||||
|
sub_objs: QuerySet[Model],
|
||||||
|
using: str,
|
||||||
|
) -> None: ...
|
||||||
|
def DO_NOTHING(
|
||||||
|
collector: "Collector",
|
||||||
|
field: Field[Any, Any],
|
||||||
|
sub_objs: QuerySet[Model],
|
||||||
|
using: str,
|
||||||
|
) -> None: ...
|
||||||
|
def PROTECT(
|
||||||
|
collector: "Collector",
|
||||||
|
field: Field[Any, Any],
|
||||||
|
sub_objs: QuerySet[Model],
|
||||||
|
using: str,
|
||||||
|
) -> None: ...
|
||||||
|
def RESTRICT(
|
||||||
|
collector: "Collector",
|
||||||
|
field: Field[Any, Any],
|
||||||
|
sub_objs: QuerySet[Model],
|
||||||
|
using: str,
|
||||||
|
) -> None: ...
|
||||||
|
def SET(value: Any) -> Callable[..., Any]: ...
|
||||||
def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field]: ...
|
def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field]: ...
|
||||||
|
|
||||||
class ProtectedError(IntegrityError):
|
class ProtectedError(IntegrityError):
|
||||||
|
|||||||
Reference in New Issue
Block a user