diff --git a/django-stubs/contrib/sessions/base_session.pyi b/django-stubs/contrib/sessions/base_session.pyi index f016f4b98..4da1bdb26 100644 --- a/django-stubs/contrib/sessions/base_session.pyi +++ b/django-stubs/contrib/sessions/base_session.pyi @@ -1,8 +1,9 @@ from datetime import datetime -from typing import Any, TypeVar +from typing import Any, ClassVar, TypeVar from django.contrib.sessions.backends.base import SessionBase from django.db import models +from typing_extensions import Self _T = TypeVar("_T", bound=AbstractBaseSession) @@ -11,10 +12,10 @@ class BaseSessionManager(models.Manager[_T]): def save(self, session_key: str, session_dict: dict[str, Any], expire_date: datetime) -> _T: ... class AbstractBaseSession(models.Model): - expire_date: datetime - session_data: str - session_key: str - objects: Any + session_key = models.CharField(primary_key=True) + session_data = models.TextField() + expire_date = models.DateTimeField() + objects: ClassVar[BaseSessionManager[Self]] @classmethod def get_session_store_class(cls) -> type[SessionBase] | None: ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index f5bd7c869..4fb92026b 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -509,6 +509,7 @@ django.contrib.sessions.backends.signed_cookies.SessionStore.exists django.contrib.sessions.base_session.AbstractBaseSession.expire_date django.contrib.sessions.base_session.AbstractBaseSession.get_next_by_expire_date django.contrib.sessions.base_session.AbstractBaseSession.get_previous_by_expire_date +django.contrib.sessions.base_session.AbstractBaseSession.objects django.contrib.sessions.base_session.AbstractBaseSession.session_data django.contrib.sessions.base_session.AbstractBaseSession.session_key django.contrib.sessions.base_session.BaseSessionManager.__slotnames__