InlineModelAdmin class InlineModelAdminclass TabularInlineclass StackedInline 举例,有两个Model: from django.db import models class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author) t
1. ModelAdmin.inlines 将有外键的子类包含进视图 ,实例: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author) title = models.CharField(max_length=100) class BookInline(admin.TabularInline): m
1.自定义模板设置: ModelAdmin. add_form_template Path to a custom template, used by add_view(). ModelAdmin. change_form_template Path to a custom template, used by change_view(). ModelAdmin. change_list_template Path to a custom template, used by changelist_