27 lines
889 B
Python
27 lines
889 B
Python
from django.contrib.auth import models as auth_models
|
|
from django.db import models
|
|
|
|
from ..choices import RoleChoice, AccountType
|
|
from ..managers import UserManager
|
|
|
|
|
|
class User(auth_models.AbstractUser):
|
|
phone = models.CharField(max_length=255, unique=True)
|
|
username = models.CharField(max_length=255, null=True, blank=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
validated_at = models.DateTimeField(null=True, blank=True)
|
|
is_verify = models.BooleanField(default=False)
|
|
account_type = models.CharField(choices=AccountType, max_length=255, default=AccountType.PERSONAL)
|
|
role = models.CharField(
|
|
max_length=255,
|
|
choices=RoleChoice,
|
|
default=RoleChoice.USER,
|
|
)
|
|
|
|
USERNAME_FIELD = "phone"
|
|
objects = UserManager()
|
|
|
|
def __str__(self):
|
|
return self.phone
|