12345678910111213141516 |
- from django.db import models
- from django.contrib.auth.models import AbstractUser
- class ShariXUser(AbstractUser):
- phone_number = models.CharField(max_length=18, unique=True, verbose_name="Номер телефона")
- avatar = models.ImageField(upload_to="useravatars/", null=True, blank=True, verbose_name="Аватар")
- USERNAME_FIELD = "phone_number"
- @property
- def full_name(self):
- if self.first_name and self.last_name:
- return f"{self.first_name} {self.last_name}"
- else:
- return self.username
|