Merge branch 'main' into storefront-nuxt
This commit is contained in:
commit
5464f31ab8
1 changed files with 16 additions and 11 deletions
|
|
@ -6,20 +6,21 @@ from django.contrib.auth.models import Group as BaseGroup
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.models import (
|
from django.db.models import (
|
||||||
BooleanField,
|
|
||||||
CharField,
|
|
||||||
EmailField,
|
|
||||||
ImageField,
|
|
||||||
JSONField,
|
|
||||||
UUIDField,
|
|
||||||
ForeignKey,
|
|
||||||
TextField,
|
|
||||||
DateTimeField,
|
|
||||||
Index,
|
|
||||||
CASCADE,
|
CASCADE,
|
||||||
SET_NULL,
|
SET_NULL,
|
||||||
|
BooleanField,
|
||||||
|
CharField,
|
||||||
|
DateTimeField,
|
||||||
|
EmailField,
|
||||||
|
ForeignKey,
|
||||||
|
ImageField,
|
||||||
|
Index,
|
||||||
|
JSONField,
|
||||||
|
TextField,
|
||||||
|
UUIDField,
|
||||||
)
|
)
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.functional import cached_property
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework_simplejwt.token_blacklist.models import (
|
from rest_framework_simplejwt.token_blacklist.models import (
|
||||||
BlacklistedToken as BaseBlacklistedToken,
|
BlacklistedToken as BaseBlacklistedToken,
|
||||||
|
|
@ -29,10 +30,10 @@ from rest_framework_simplejwt.token_blacklist.models import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from engine.core.abstract import NiceModel
|
from engine.core.abstract import NiceModel
|
||||||
|
from engine.payments.models import Balance
|
||||||
from engine.vibes_auth.choices import SenderType, ThreadStatus
|
from engine.vibes_auth.choices import SenderType, ThreadStatus
|
||||||
from engine.vibes_auth.managers import UserManager
|
from engine.vibes_auth.managers import UserManager
|
||||||
from engine.vibes_auth.validators import validate_phone_number
|
from engine.vibes_auth.validators import validate_phone_number
|
||||||
from engine.payments.models import Balance
|
|
||||||
|
|
||||||
|
|
||||||
class User(AbstractUser, NiceModel): # type: ignore [django-manager-missing]
|
class User(AbstractUser, NiceModel): # type: ignore [django-manager-missing]
|
||||||
|
|
@ -98,6 +99,10 @@ class User(AbstractUser, NiceModel): # type: ignore [django-manager-missing]
|
||||||
# noinspection PyClassVar
|
# noinspection PyClassVar
|
||||||
objects = UserManager() # type: ignore [misc, assignment]
|
objects = UserManager() # type: ignore [misc, assignment]
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def avatar_url(self):
|
||||||
|
return self.avatar.url
|
||||||
|
|
||||||
def add_to_recently_viewed(self, product_uuid):
|
def add_to_recently_viewed(self, product_uuid):
|
||||||
recently_viewed = self.recently_viewed
|
recently_viewed = self.recently_viewed
|
||||||
if product_uuid not in recently_viewed:
|
if product_uuid not in recently_viewed:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue