Skip to content

Commit

Permalink
Remove useless event queryset exclude causing unacceptable delays
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikuoja committed Mar 21, 2017
1 parent 2835b9f commit 8d28b76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion events/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,8 @@ def filter_division(self, queryset, name, value):

class EventViewSet(BulkModelViewSet, JSONAPIViewSet):
queryset = Event.objects.filter(deleted=False)
queryset = queryset.exclude(super_event_type=Event.SuperEventType.RECURRING, sub_events=None)
# This exclude is, atm, a bit overkill, considering it causes a massive query and no such events exist.
# queryset = queryset.exclude(super_event_type=Event.SuperEventType.RECURRING, sub_events=None)
# Use select_ and prefetch_related() to reduce the amount of queries
queryset = queryset.select_related('location')
queryset = queryset.prefetch_related(
Expand Down

0 comments on commit 8d28b76

Please sign in to comment.