Skip to content Skip to sidebar Skip to footer

Django: Can't Include The Manytomanyfield Field Because Manually Specifies A 'through' Model

I googled many times and found only one solution to add custom intermediate model for two model having relation through 3rd model. And I applied as usual as suggested but still get

Solution 1:

You have to change the admin to include InlineModelAdmin objects

So, change

classAdminPost(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields':['title', 'content', 'terms']})
    ]

to

classTermInlineAdmin(admin.TabularInline):
    model = Post.terms.through


classAdminPost(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields':['title', 'content']})
    ]

    inlines = (TermInlineAdmin,)

Post a Comment for "Django: Can't Include The Manytomanyfield Field Because Manually Specifies A 'through' Model"