AI智能
改变未来

django中配置xadmin时报错metaclass conflict: the metaclass of a derived class must be a (non-strict) subcla

报错信息如下:
原因:
没有修改我们定义的ModelAdmin的继承对象为object或去掉继承

错误代码如下:

@xadmin.sites.register(Comment)class CommentAdmin(admin.ModelAdmin):list_display = [\"target\", \"nickname\", \"content\", \"website\", \"created_time\"]

应修改为

@xadmin.sites.register(Comment)class CommentAdmin(object):list_display = [\"target\", \"nickname\", \"content\", \"website\", \"created_time\"]或者:@xadmin.sites.register(Comment)class CommentAdmin:list_display = [\"target\", \"nickname\", \"content\", \"website\", \"created_time\"]
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » django中配置xadmin时报错metaclass conflict: the metaclass of a derived class must be a (non-strict) subcla