29 lines
787 B
Python
29 lines
787 B
Python
from django.contrib.auth.models import AbstractUser
|
|||
|
|
from django.db import models
|
||
|
|
|
||
|
|
|
||
|
|
class User(AbstractUser):
|
||
|
|
class Status(models.TextChoices):
|
||
|
|
ACTIVE = "active", "Active"
|
||
|
|
DISABLED = "disabled", "Disabled"
|
||
|
|
|
||
|
|
email = models.EmailField("email address")
|
||
|
|
payment_user_id = models.CharField(
|
||
|
|
max_length=128,
|
||
|
|
blank=True,
|
||
|
|
help_text="External payment system user identifier, if available.",
|
||
|
|
)
|
||
|
|
status = models.CharField(
|
||
|
|
max_length=20,
|
||
|
|
choices=Status.choices,
|
||
|
|
default=Status.ACTIVE,
|
||
|
|
)
|
||
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
||
|
|
|
||
|
|
@property
|
||
|
|
def is_business_active(self) -> bool:
|
||
|
|
return self.status == self.Status.ACTIVE and self.is_active
|
||
|
|
|
||
|
|
class Meta:
|
||
|
|
db_table = "user"
|