Complete the code to import the inline admin class.
from django.contrib import admin from .models import Book, Chapter class ChapterInline([1]): model = Chapter
The StackedInline class is used to display related models inline in a stacked layout.
Complete the code to register the Book model with the Chapter inline.
class BookAdmin(admin.ModelAdmin): inlines = [[1]] admin.site.register(Book, BookAdmin)
The inlines attribute expects a list of inline classes, not instances. So just the class name without parentheses is correct.
Fix the error in the inline admin by completing the missing attribute.
class ChapterInline(admin.StackedInline): model = Chapter extra = [1]
The extra attribute expects an integer indicating how many extra blank forms to show. It should not be a string.
Fill both blanks to customize the inline admin to show 3 extra forms and use a tabular layout.
class ChapterInline(admin.[1]): model = Chapter extra = [2]
Using TabularInline shows related objects in a table. Setting extra = 3 shows three blank forms for new related objects.
Fill all three blanks to create an inline admin for a related model Author with 2 extra stacked forms and register it with the Book model.
class [1](admin.[2]): model = Author extra = [3] class BookAdmin(admin.ModelAdmin): inlines = [AuthorInline] admin.site.register(Book, BookAdmin)
The inline admin class is named AuthorInline, uses StackedInline for layout, and sets extra = 2 to show two blank forms.