Я пытаюсь настроить модель пользователя Django, но я получаю эту ошибку при выполнении миграций
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E033) The value of 'ordering[0]' refers to 'username', which is not an attribute of 'cms.PageUser'.
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E108) The value of 'list_display[0]' refers to 'username', which is not a callable, an attribute of 'PageUserAdmin', or an attribute or method on 'cms.PageUser'.
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E108) The value of 'list_display[2]' refers to 'first_name', which is not a callable, an attribute of 'PageUserAdmin', or an attribute or method on 'cms.PageUser'.
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E108) The value of 'list_display[3]' refers to 'last_name', which is not a callable, an attribute of 'PageUserAdmin', or an attribute or method on 'cms.PageUser'.
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E116) The value of 'list_filter[0]' refers to 'is_staff', which does not refer to a Field.
<class 'cms.admin.useradmin.PageUserAdmin'>: (admin.E116) The value of 'list_filter[2]' refers to 'is_active', which does not refer to a Field.
мой класс usermanager:
class UserManager(BaseUserManager):
def create_user(self,email,number,password=None,is_active=True,is_staff=False,is_admin=False):
if not email:
raise ValueError("error")
if not password:
raise ValueError ("error")
if not number:
raise ValueError("error")
user_obg = self.model(
email = self.normalize_email(email)
)
user_obg.set_password(password)
user_obg.staff = is_staff
user_obg.admin = is_admin
user_obg.active = is_active
user_obg.save(using=self._db)
return user_obg
def create_staffuser(self,email,password=None):
user= self.create_user(
email,
password=password,
is_staff=True
)
return user
def create_admin(self,email,password=None):
user= self.create_user(
email,
password=password,
is_staff=True,
is_admin=True
)
моя модель пользователя:
class Cuser(AbstractBaseUser,PermissionsMixin):
email = models.EmailField(unique=True,max_length=255)
number = models.IntegerField(max_length=12,unique=True)
user_name = models.CharField(max_length=100)
active = models.BooleanField(default=True)
staff = models.BooleanField(default=False)
admin = models.BooleanField(default=False)
timestamp = models.DateTimeField(auto_now_add=True)
USERNAME_FIELD = 'number'
REQUIRED_FIELDS = []
def __str__(self):
return self.name
def get_full_name(self):
return self.name
def get_short_name(self):
return self.name
@property
def is_staff(self):
return self.staff
@property
def is_admin(self):
return self.admin
@property
def is_active(self):
return self.is_active
есть предложения?