我正在尝试扩展Django的auth User模型类。我有一个问题和一个问题。这是我的模特:
from django.contrib.auth.models import User
class BaseUser(models.Model):
"""
some common fields
"""
user = User.ForeignKey(User, unique=True)
class Meta:
verbose_name = 'Base User'
verbose_name_plural = 'Base Users'
User.profile = property(lambda u: BaseUser.objects.get_or_create(user=u)[0])
class Client(BaseUser):
"""
some client specific fields
"""
class Meta:
verbose_name = 'Client'
verbose_name_plural = 'Clients'
class Owner(BaseUser):
"""
some owner specific fields
"""
class Meta:
verbose_name = 'Owner'
verbose_name_plural = 'Owners'
class Driver(BaseUser):
"""
some driver specific fields
"""
class Meta:
verbose_name = 'Driver'
verbose_name_plural : 'Drivers'
我的问题:当我去管理网站检查客户端时,我收到此错误(该应用程序名为etaxi_prod):
column etaxi_prod_baseuser.id does not exist
这里发生了什么?
我的问题是,如果找到上述解决方案:我应该怎样做才能使BaseUser类抽象,以便只处理Client,Driver和Owner作为用户auth类?