【发布时间】:2015-12-30 04:03:12
【问题描述】:
我在 ModelAdmin 类中有一个内联表格视图 (GenericTabularInline)。我需要添加链接以更改该内联表格视图中的表单。这是一些参考代码
class StudentActionInline(generic.GenericTabularInline):
model = StudentActionInline
ordering = ('roll_no',)
class CaptainAdmin(admin.ModelAdmin):
inlines = [
StudentActionInline
]
我想在内联表格视图中添加一个链接以更改学生模型(更改学生模型的表单)。这是在 Django 1.7 中
【问题讨论】:
-
如果我理解正确的话,Student 模型是在管理员那里注册的,您只想添加一个链接到与内联表单中的 StudentActionInline 关联的学生实例的更改页面?我假设 StudentActionInline 对 Student 有一个 fk?
标签: django django-models django-admin