Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Nov 6, 2024
1 parent 11cc4fc commit 2664b2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions codeforlife/models/abstract_base_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
AbstractBaseSession as _AbstractBaseSession,
)
from django.db import models
from django.db.models import Manager
from django.utils import timezone
from django.utils.translation import gettext_lazy as _

from .abstract_base_user import AbstractBaseUser
from .base import Model

if t.TYPE_CHECKING:
from django_stubs_ext.db.models import TypedModelMeta
Expand All @@ -24,13 +24,14 @@
TypedModelMeta = object


class AbstractBaseSession(Model, _AbstractBaseSession):
class AbstractBaseSession(_AbstractBaseSession):
"""
Base session class to be inherited by all session classes.
https://docs.djangoproject.com/en/3.2/topics/http/sessions/#example
"""

pk: str # type: ignore[assignment]
objects: Manager[t.Self]

user_id: int
user = models.OneToOneField(
Expand Down
6 changes: 3 additions & 3 deletions codeforlife/models/abstract_base_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import typing as t

from django.contrib.auth.models import AbstractBaseUser as _AbstractBaseUser
from django.db.models import Manager
from django.utils.translation import gettext_lazy as _

from .base import Model

if t.TYPE_CHECKING:
from django_stubs_ext.db.models import TypedModelMeta

Expand All @@ -18,7 +17,7 @@
TypedModelMeta = object


class AbstractBaseUser(Model, _AbstractBaseUser):
class AbstractBaseUser(_AbstractBaseUser):
"""
Base user class to be inherited by all user classes.
https://docs.djangoproject.com/en/3.2/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project
Expand All @@ -27,6 +26,7 @@ class AbstractBaseUser(Model, _AbstractBaseUser):
id: int
pk: int
session: "AbstractBaseSession"
objects: Manager[t.Self]

# pylint: disable-next=missing-class-docstring,too-few-public-methods
class Meta(TypedModelMeta):
Expand Down

0 comments on commit 2664b2e

Please sign in to comment.