📜  django 两个外键到同一模型管理错误 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:31.106000             🧑  作者: Mango

代码示例1
class UserProfileInline(admin.StackedInline):
    model = Profile
    fk_name = "user"

class SupervisorProfileInline(admin.StackedInline):
    model = Profile
    fk_name = "supervisor"

class NewUserAdmin(NamedUserAdmin):
    inlines = [UserProfileInline, SupervisorProfileInline]

# Django documentation on dealing with this: https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#working-with-a-model-with-two-or-more-foreign-keys-to-the-same-parent-model