[Django]-InlineModelAdmin not showing up on admin page

7👍

This is what you should have in admins.py:

from django.contrib import admin
from models import Author, Book

class BookInline(admin.StackedInline):
    model = Book


class AuthorAdmin(admin.ModelAdmin):
    inlines = [ BookInline ]

admin.site.register(Author, AuthorAdmin)
admin.site.register(Book)

You probably forgot to include ‘AuthorAdmin’ in this line:

admin.site.register(Author, AuthorAdmin)
👤Cheng

Leave a comment