编程语言
首页 > 编程语言> > xadmin运行报错:ImportError: cannot import name 'DEFAULT_FORMATS' from 'import_export.admi

xadmin运行报错:ImportError: cannot import name 'DEFAULT_FORMATS' from 'import_export.admi

作者:互联网

xadmin运行报错:

File "/home/lijun/app/hippo/hippo_api/venv/lib/python3.8/site-packages/xadmin/plugins/importexport.py", line 48, in <module>
from import_export.admin import DEFAULT_FORMATS, SKIP_ADMIN_LOG, TMP_STORAGE_CLASS
ImportError: cannot import name 'DEFAULT_FORMATS' from 'import_export.admin' (/home/lijun/app/hippo/hippo_api/venv/lib/python3.8/site-packages/import_export/admin.py)

Django版本:2.2

Xadmin版本:2.0.1

python版本:3.8.10

报错解决办法:

点击进入报错目录:importexport.py

 

 

注释报错行:

# from import_export.admin import DEFAULT_FORMATS, SKIP_ADMIN_LOG, TMP_STORAGE_CLASS

并添加如下代码:

from import_export.formats.base_formats import DEFAULT_FORMATS
from import_export.admin import ImportMixin, ImportExportMixinBase

如下图:

 

标签:hippo,admin,export,报错,FORMATS,import
来源: https://www.cnblogs.com/LoveMoney-MrLi/p/15769108.html