Skip to content

Commit

Permalink
Remove useless admin_user=false filter that causes massive subquery
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikuoja committed Jan 22, 2019
1 parent 7de2238 commit 94e8a7b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions events/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,12 +1781,8 @@ def filter_queryset(self, queryset):
# displays all editable events, including drafts, and public non-editable events
queryset = editable_queryset | public_queryset
if 'admin_user' in self.request.query_params:
if self.request.query_params['admin_user'] in ('false', 'none'):
# displays only public non-editable events
queryset = public_queryset.difference(editable_queryset)
else:
# displays all editable events, including drafts, but no other public events
queryset = editable_queryset
# displays all editable events, including drafts, but no other public events
queryset = editable_queryset
else:
# prevent changing events user does not have write permissions (for bulk operations)
queryset = self.request.user.get_editable_events(original_queryset)
Expand Down

0 comments on commit 94e8a7b

Please sign in to comment.