有没有办法扩展内置的Django Group对象以添加类似于扩展用户对象的方式的其他属性?使用用户对象,您可以执行以下操作:
class UserProfile(models.Model):
user = models.OneToOneField(User)
Run Code Online (Sandbox Code Playgroud)
并将以下内容添加到settings.py文件中
AUTH_PROFILE_MODULE = 'app.UserProfile'
Run Code Online (Sandbox Code Playgroud)
哪个让你:
profile = User.objects.get(id=1).get_profile()
Run Code Online (Sandbox Code Playgroud)
是否有任何相当于扩展组的方法?如果没有,我可以采取另一种方法吗?