To be able to edit multiple objects from one Django admin, you need to use inlines.
You have the
Category
model, and you need to add and edit Villain
models inside the admin for Category. You can do:class VillainInline(admin.StackedInline):
model = Villain
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
...
inlines = [VillainInline]
You can see the form to add and edit
Villain
inside the Category
admin. If the Inline model has alot of fields, use StackedInline
else use TabularInline
.
No comments:
Post a Comment