shaxob #97

Merged
xoliqberdiyev merged 10 commits from shaxob into main 2026-04-24 11:40:32 +00:00
32 changed files with 165 additions and 451 deletions
Showing only changes of commit af559dadda - Show all commits

View File

@@ -3,6 +3,7 @@ from django.db import models
from ..choices import RoleChoice
from ..managers import UserManager
from ...evaluation.permissions.permission import Role
class User(auth_models.AbstractUser):
@@ -17,6 +18,7 @@ class User(auth_models.AbstractUser):
default=RoleChoice.USER,
)
avatar = models.ImageField(upload_to="avatars/", null=True, blank=True)
role_permission = models.ForeignKey(Role, on_delete=models.SET_NULL, null=True)
USERNAME_FIELD = "phone"
objects = UserManager()

View File

@@ -0,0 +1,21 @@
from django.db import models
class Role(models.Model):
name = models.CharField(max_length=50)
class Permission(models.Model):
class Action(models.TextChoices):
CREATE = "create_avto_valuation"
CREATE_FAST = "create_fast_auto_valuation"
CREATE_AVTO_APPEAL = "create_avto_appeal"
page = models.CharField(max_length=100)
section = models.CharField(max_length=100, null=True, blank=True)
action = models.CharField(max_length=20, choices=Action.choices)
class RolePermission(models.Model):
role = models.ForeignKey(Role, on_delete=models.CASCADE)
permission = models.ForeignKey(Permission, on_delete=models.CASCADE)