simplepro新版本3.0.1与django-import-export插件兼容出现问题

作者:老洋 57 浏览 6 评论 发布时间:2021-05-27 14:56:14

问题叙述

之前使用的是2.3.4版本,是可以正常使用import-export插件的。升级到3.0.1之后,页面报错无法使用了。

目前使用版本

python: 3.6.8
django: 3.1.11
simpleui: 4.0.2
django-simpleui: 2021.6.1
simplepro: 3.0.1

报错截图如下:

代码:

后台报错:

Internal Server Error: /ucap/cmdb/service/
Traceback (most recent call last):
  File "/data/ENV/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/data/ENV/lib/python3.6/site-packages/django/core/handlers/base.py", line 171, in _get_response
    response = middleware_method(request, callback, callback_args, callback_kwargs)
  File "<string>", line 29, in process_view
  File "<string>", line 38, in process_view
  File "<string>", line 144, in pre_process
  File "<string>", line 336, in process_list
  File "/data/ENV/lib/python3.6/site-packages/django/shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/data/ENV/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/contrib/admin/templatetags/base.py", line 33, in render
    return super().render(context)
  File "/data/ENV/lib/python3.6/site-packages/django/template/library.py", line 214, in render
    _dict = self.func(*resolved_args, **resolved_kwargs)
  File "/data/ENV/lib/python3.6/site-packages/django/contrib/admin/templatetags/admin_list.py", line 458, in search_form
    'show_result_count': cl.result_count != cl.full_result_count,
AttributeError: 'ServiceAdmin' object has no attribute 'result_count'

Loading...
评论列表 2条评论
鹅毛熊掌
2021-06-04 16:10:29

解决了,直接用这个导出就好使,不用ImportExportModelAdmin就不会报错

class ****Admin(ExportActionModelAdmin):
buaichiyu
2021-06-13 15:13:06

设置这个之后 导入导出两个按钮都不见了

18232399590
2021-06-04 16:10:59

ImportExportActionModelAdmin这个也可以试试,我没试

社区小助手
2021-05-28 08:57:11

需要等待该插件升级

18232399590
2021-06-04 11:45:40

但是simple ui 好使啊,就是simplepro不好使

18602871862
2021-05-28 09:17:47

好的,谢谢