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 2664b2e commit a351a67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions codeforlife/models/abstract_base_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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 _

Expand All @@ -31,7 +30,6 @@ class AbstractBaseSession(_AbstractBaseSession):
"""

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

user_id: int
user = models.OneToOneField(
Expand Down
2 changes: 0 additions & 2 deletions codeforlife/models/abstract_base_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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 _

if t.TYPE_CHECKING:
Expand All @@ -26,7 +25,6 @@ class AbstractBaseUser(_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
4 changes: 3 additions & 1 deletion codeforlife/models/base_session_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def create_model_instance(self, data):
session = model_class.objects.get(user_id=user_id)
except model_class.DoesNotExist:
session = model_class.objects.get(session_key=self.session_key)
self.associate_session_to_user(session, user_id)
self.associate_session_to_user(
t.cast(AnyAbstractBaseSession, session), user_id
)

session.session_data = self.encode(data)

Expand Down

0 comments on commit a351a67

Please sign in to comment.