xadmin Error:
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 Version: 2.2
Xadmin Version: 2.0.1
python Version: 3.8.10
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 Version: 2.2
Xadmin Version: 2.0.1
python Version: 3.8.10
Solution:
Click to go to the error report directory at: importexport.py
Note the error message line:
Click to go to the error report directory at: importexport.py
Note the error message line:
# from import_export.admin import DEFAULT_FORMATS, SKIP_ADMIN_LOG, TMP_STORAGE_CLASS
And add the following code:
from import_export.formats.base_formats import DEFAULT_FORMATS from import_export.admin import ImportMixin, ImportExportMixinBase
As shown below: