perf: Add last login date update for account on session save

This commit is contained in:
wangruidong
2025-02-26 15:16:16 +08:00
committed by w940853815
parent ff9ad2680f
commit 385bf47b11
4 changed files with 14 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from accounts.models import Account
from assets.models import Asset
from common.const.signals import OP_LOG_SKIP_SIGNAL
from common.utils import get_object_or_none, lazyproperty
@@ -125,6 +126,10 @@ class Session(OrgModelMixin):
def user_obj(self):
return User.objects.get(id=self.user_id)
@property
def account_obj(self):
return get_object_or_none(Account, pk=self.account_id)
def can_replay(self):
return self.has_replay