Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #foreignkeys #model #admin #error
ADD COMMENT
Topic
Name
7+8 =