浏览代码

Fixed a bug where it was impossible to create a superuser using standard Django tools

TonyKurts 1 月之前
父节点
当前提交
8ae15e5d08
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      models.py

+ 2 - 2
models.py

@@ -8,7 +8,7 @@ class ShariXUser(AbstractUser):
     avatar = models.ImageField(upload_to="user_avatars/", null=True, blank=True, verbose_name="Аватар")
 
     USERNAME_FIELD = "phone_number"
-    REQUIRED_FIELDS = ['first_name', 'last_name']
+    REQUIRED_FIELDS = ['username', 'first_name', 'last_name']
 
     def __str__(self):
-        return f"{self.first_name} {self.last_name}{" " + self.patronymic if self.patronymic else ""}"
+        return f"{self.first_name} {self.last_name}{' ' + self.patronymic if self.patronymic else ''}"