From 7954c1bb9063b153fb18687247495c7b7f6e8701 Mon Sep 17 00:00:00 2001 From: Maxim Kurnikov Date: Wed, 26 Sep 2018 17:05:42 +0300 Subject: [PATCH] add DoesNotExist exception to Model --- django-stubs/db/models/base.pyi | 5 ++++- django-stubs/db/models/query.pyi | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index 6ed3099..f3ee961 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union from uuid import UUID from django.core.checks.messages import Warning -from django.core.exceptions import ValidationError +from django.core.exceptions import ValidationError, ObjectDoesNotExist from django.db.models.fields.related import ForeignKey @@ -40,6 +40,9 @@ class ModelState: fields_cache: Any = ... class Model: + class DoesNotExist(ObjectDoesNotExist): + pass + def __init__(self, *args: Any, **kwargs: Any) -> None: ... @classmethod def from_db( diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index c6e4eb6..d98185f 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -96,8 +96,6 @@ class QuerySet(Generic[_T]): def as_manager(cls): ... - as_manager: Any = ... - def __deepcopy__( self, memo: Dict[