mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
extend ProtectedError and RestrictedError stubs (#682)
types for their properties
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Collection, Iterable, Optional, Type, Union
|
||||
from typing import Any, Callable, Collection, Iterable, Optional, Set, Type, Union
|
||||
|
||||
from django.db import IntegrityError
|
||||
from django.db.models.base import Model
|
||||
@@ -14,8 +14,13 @@ def RESTRICT(collector, field, sub_objs, using): ...
|
||||
def SET(value: Any) -> Callable: ...
|
||||
def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field]: ...
|
||||
|
||||
class ProtectedError(IntegrityError): ...
|
||||
class RestrictedError(IntegrityError): ...
|
||||
class ProtectedError(IntegrityError):
|
||||
protected_objects: Set[Model]
|
||||
def __init__(self, msg: str, protected_objects: Set[Model]) -> None: ...
|
||||
|
||||
class RestrictedError(IntegrityError):
|
||||
restricted_objects: Set[Model]
|
||||
def __init__(self, msg: str, restricted_objects: Set[Model]) -> None: ...
|
||||
|
||||
class Collector:
|
||||
def __init__(self, using: str) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user