[Django]-Django: can't include the ManyToManyField field because manually specifies a 'through' model

31👍

You have to change the admin to include InlineModelAdmin objects

So, change

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

to

class TermInlineAdmin(admin.TabularInline):
    model = Post.terms.through


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

    inlines = (TermInlineAdmin,)

Leave a comment