|
@@ -3,15 +3,12 @@ from django.contrib.auth.models import AbstractUser
|
|
|
|
|
|
|
|
|
|
class ShariXUser(AbstractUser):
|
|
class ShariXUser(AbstractUser):
|
|
|
|
+ middle_name = models.CharField(max_length=150, null=True, blank=True, verbose_name="Отчество")
|
|
phone_number = models.CharField(max_length=18, unique=True, verbose_name="Номер телефона")
|
|
phone_number = models.CharField(max_length=18, unique=True, verbose_name="Номер телефона")
|
|
- avatar = models.ImageField(upload_to="useravatars/", null=True, blank=True, verbose_name="Аватар")
|
|
|
|
|
|
+ avatar = models.ImageField(upload_to="user_avatars/", null=True, blank=True, verbose_name="Аватар")
|
|
|
|
|
|
USERNAME_FIELD = "phone_number"
|
|
USERNAME_FIELD = "phone_number"
|
|
- REQUIRED_FIELDS = ['username']
|
|
|
|
|
|
+ REQUIRED_FIELDS = ['first_name', 'last_name']
|
|
|
|
|
|
- @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
|
|
|
|
|
|
+ def __str__(self):
|
|
|
|
+ return f"{self.first_name} {self.last_name}{" " + self.patronymic if self.patronymic else ""}"
|