django two foreignkeys to same model admin error code example

Example: django two foreignkeys to same model admin error

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

Tags:

Misc Example