我正在尝试从默认的Django用户模型切换到自定义用户模型。当我尝试迁移更改时,出现错误:
参数@objname模棱两可或声明的@objtype(COLUMN)错误。
我正在使用pyodbc的驱动程序13。如果我伪造了迁移文件,则该迁移文件有效,但在尝试实际运行该迁移文件时会抛出上述错误。
class OUser(AbstractBaseUser):
"""
Our custom user model which may be extended later.
"""
email = models.EmailField(verbose_name='email address', max_length=255, unique=True)
username = models.CharField(max_length=150, unique=True)
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False) # a superuser
first_name = models.CharField(max_length=100, blank=True, default='')
last_name = models.CharField(max_length=100, blank=True, default='')
date_joined = models.DateField(auto_now=True)
password = models.CharField(max_length=100)
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = [] # Email & Password are required by default.
def __str__(self):
return self.username
@property
def is_staff(self):
"""Is the user a member of staff?"""
return self.is_staff
@property
def is_admin(self):
return self.is_superuser
@property
def is_active(self):
return self.is_active
objects = UserManager()
我不知道此错误可能来自何处。有人有什么主意吗?