mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-17 17:35:59 +08:00
Changed model exceptions to use more specific base classes. (#490)
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
from typing import Any, Callable, Collection, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union
|
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.checks.messages import CheckMessage
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import (
|
||||||
|
ValidationError,
|
||||||
|
ObjectDoesNotExist,
|
||||||
|
MultipleObjectsReturned as BaseMultipleObjectsReturned,
|
||||||
|
)
|
||||||
from django.db.models.manager import BaseManager
|
from django.db.models.manager import BaseManager
|
||||||
from django.db.models.options import Options
|
from django.db.models.options import Options
|
||||||
|
|
||||||
@@ -17,8 +21,8 @@ class ModelState:
|
|||||||
class ModelBase(type): ...
|
class ModelBase(type): ...
|
||||||
|
|
||||||
class Model(metaclass=ModelBase):
|
class Model(metaclass=ModelBase):
|
||||||
class DoesNotExist(Exception): ...
|
class DoesNotExist(ObjectDoesNotExist): ...
|
||||||
class MultipleObjectsReturned(Exception): ...
|
class MultipleObjectsReturned(BaseMultipleObjectsReturned): ...
|
||||||
class Meta: ...
|
class Meta: ...
|
||||||
_meta: Options[Any]
|
_meta: Options[Any]
|
||||||
_default_manager: BaseManager[Model]
|
_default_manager: BaseManager[Model]
|
||||||
|
|||||||
Reference in New Issue
Block a user