add login api

This commit is contained in:
behruz-dev
2025-08-01 10:16:36 +05:00
parent f89a257553
commit 0a2127d826
22 changed files with 307 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _
from core.apps.shared.models import BaseModel
from core.apps.accounts.models.role import Role
class User(BaseModel, AbstractUser):
profile_image = models.ImageField(
upload_to="users/profile_images/", null=True, blank=True, verbose_name=_('profil rasmi')
)
role = models.ForeignKey(Role, on_delete=models.DO_NOTHING, null=True, related_name="users")
REQUIRED_FIELDS = []
def __str__(self):
return self.username
class Meta:
verbose_name = _("Foydalanuvchi")
verbose_name_plural = _("Foydalanuvchilar")