(admin.E104) 'XXXX' must inherit from 'InlineModelAdmin'.

代码:

class CaseStepAdmin(admin.ModelAdmin):
    list_display = ('id', 'casetep', 'casedata', 'webcase', 'stepresult', 'update_time', 'create_time')
    model = CaseStep
    extra = 1
class WebCaseAdmin(admin.ModelAdmin):
    list_display = ('id', 'casename', 'caseresult', 'casetester', 'module',
                    'update_time', 'create_time')
    list_display_links = ('casename',)
    ordering = ('-create_time',)
    search_fields = ('casename', 'caseresult')
    inlines = [CaseStepAdmin]

使用python manage.py migrations同步数据时提示 (admin.E104) 'web.admin.CaseStepAdmin' must inherit from 'InlineModelAdmin'.将一个模型作为内连放入另一个模型,需要继承TabularInline

更改后:

class CaseStepAdmin(admin.TabularInline):

 

posted @ 2020-08-31 14:14  **绵绵羊**  阅读(694)  评论(0编辑  收藏  举报