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

2022/1/6 9:10:26

本文主要是介绍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

如下图:

 



这篇关于xadmin运行报错:ImportError: cannot import name 'DEFAULT_FORMATS' from 'import_export.admi的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程