seldom-platform icon indicating copy to clipboard operation
seldom-platform copied to clipboard

点击测试报告后端报错

Open 2504973175 opened this issue 2 years ago • 2 comments

get_queryset() got an unexpected keyword argument 'task_id' Traceback (most recent call last): File "E:\Software\Python37\lib\site-packages\ninja\operation.py", line 104, in run result = self.view_func(request, **values) File "E:\Software\Python37\lib\site-packages\ninja\pagination.py", line 140, in view_with_pagination items = func(*args, **kwargs) File "F:\seldom-platform\backend\app_task\api.py", line 188, in get_report_list return TaskReport.objects.get_queryset(task_id=task_id).order_by("-create_time")[:1000] TypeError: get_queryset() got an unexpected keyword argument 'task_id'

需要修改get_report_list 方法对应return中调用的方法 image

2504973175 avatar Aug 23 '23 08:08 2504973175

image 这个接口是获取报告列表的,ORM查询语句没有错误。

可能出现问题的原因:

  1. 你安装的 django/ django-ninjia 版本与我不一致。
  2. 你的数据库有 错误的数据导致。

defnngj avatar Sep 09 '23 16:09 defnngj

在一次实现分页中,我将 filter() 改成了 get_queryset , 不过,已经记不得为什么了。查了 get_queryset 貌似和分页没有必然联系。不过,你已经改回来了,非常感谢。

image

defnngj avatar Sep 09 '23 16:09 defnngj