我已按docs。
中所述创建了自定义用户模型models.py
class Account(AbstractUser):
middle_name = models.CharField(_('middle name'), max_length=30, blank=True)
is_partner = models.BooleanField(_('partner status'), default=False,
help_text=_('Designates whether the user is partner or employee'))
forms.py
class AccountChangeForm(UserChangeForm):
class Meta:
model = Account
class AccountCreationForm(UserCreationForm):
class Meta:
model = Account
admin.py
class AccountAdmin(UserAdmin):
form = AccountChangeForm
add_form = AccountCreationForm
fieldsets = (
(None, {'fields': ('username', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'middle_name', 'last_name', 'email')}),
(_('Permissions'), {'fields': ('is_active', 'is_partner', 'is_staff', 'is_superuser',
'groups', 'user_permissions')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
admin.site.register(Account, AccountAdmin)
一切正常,但现在用户和组在管理员的不同应用程序中:
是否可以将自定义用户模型和组放在一个应用程序中?