Skip to content

Commit

Permalink
don't remove objects / DoesNotExist / etc. from model classes
Browse files Browse the repository at this point in the history
django-stubs fails to restore these in too many cases.  see upstream issue typeddjango#1744

(not upstreamed)
  • Loading branch information
asottile-sentry committed Oct 31, 2023
1 parent b431663 commit c122d5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions django-stubs/contrib/sessions/base_session.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import Any, Literal, TypeVar
from typing import Any, ClassVar, Literal, TypeVar

from django.contrib.sessions.backends.base import SessionBase
from django.db import models
Expand All @@ -14,7 +14,7 @@ class AbstractBaseSession(models.Model):
expire_date: datetime
session_data: str
session_key: str
objects: Any
objects: ClassVar[Any]

class Meta:
abstract: Literal[True]
Expand Down
2 changes: 1 addition & 1 deletion mypy_django_plugin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def get_method_hook(self, fullname: str) -> Optional[Callable[[MethodContext], M

def get_customize_class_mro_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
if fullname == fullnames.MODEL_CLASS_FULLNAME:
return MetaclassAdjustments.adjust_model_class
return None

sym = self.lookup_fully_qualified(fullname)
if (
Expand Down

0 comments on commit c122d5c

Please sign in to comment.