我开始使用 django,我想扩展基本django.contrib.auth.models.User
类来创建我自己的站点配置文件。这里描述了如何做到这一点,明白了。
据我了解,您只能AUTH_PROFILE_MODULE
在settings.py
.
现在,如果我像这样创建我的配置文件类的扩展类
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
somefield = models.CharField()
class UserProfileExtended(UserProfile):
extrafield = models.CharField()
那么我不能让他们两个都配置文件类,对吗?
(我知道,在这种情况下,您只需将 the 添加extrafield
到超类并完全删除UserProfileExtended
。想象一下您有这么多字段UserProfileExtended
,您真的想将它们拆分)
谢谢你的帮助!