Skip to content

修复列表页重复查询的问题#590

Merged
wgbbiao merged 1 commit intosshwsfc:django2from
hongweipeng:patch-1
Jun 27, 2018
Merged

修复列表页重复查询的问题#590
wgbbiao merged 1 commit intosshwsfc:django2from
hongweipeng:patch-1

Conversation

@hongweipeng
Copy link

还是重复查询的问题,我在 adminx.py 里重载了 queryset() ,发现在列表页,该函数执行了两次。经过跟踪是在 ListAdminView.make_result_list() 中:

 def make_result_list(self):
    # Get search parameters from the query string.
    self.base_queryset = self.queryset()
    self.list_queryset = self.get_list_queryset()

这两句都是查询会调用 queryset() 。经排查,变量 base_queryset 整个xadmin项目都没有用到,完全可以删除。

@wgbbiao wgbbiao merged commit 475289b into sshwsfc:django2 Jun 27, 2018
@hongweipeng hongweipeng deleted the patch-1 branch June 27, 2018 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants