django中配置xadmin时报错metaclass conflict: the metaclass of a derived class must be a (non-strict) subcla
2020-07-25 16:16
537 查看
报错信息如下:
原因:
没有修改我们定义的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"]
相关文章推荐
- hibernate:newclass.hbm.xml文件错误(the content of element type "class" must match "(meta*,column*,type?generator?...)
- Django的urls.py加载静态资源图片,TypeError: view must be a callable or a list/tuple in the case of include()....
- Django URLs error: view must be a callable or a list/tuple in the case of include()
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- django 单元测试报错: view must be a callable or a list/tuple in the case of include().
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- .NET中使用GridView控件输入数据时出现“ Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"的问题
- Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex
- Django URLs error: view must be a callable or a list/tuple in the case of include()
- EnumUtils.getEnum 异常 The Class must be a subclass of Enum
- Hibernate配置文件错误提示,The content of element type "list" must match "(meta*,subselect?,cache?,synchroniz
- The content of element type "hibernate-mapping" must match "(meta*,typedef*,import*,(class|subclass|
- iOS:Class Foo is implemented in both MyApp and OtherApp. One of the two will be used. Which one is u
- 项目启动报错 content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,...)"
- Django:ExtendsNode: extends 'base/base.html'> must be the first tag in the template.
- The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collectio
- java-No exception of type ConfigurationException can be thrown; an exception type must be a subclass of Throwable
- The content of element type "session-factory" must match "(property*,mapping*,(class-cache| collect
- 微信证书 javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
- OpenCV(4.1.0) Error: Bad argument (in the case of classification problem the responses must be .....