Skip to content
Snippets Groups Projects
Unverified Commit 3c771cc2 authored by Fredrik Jonsson's avatar Fredrik Jonsson Committed by GitHub
Browse files

Merge pull request #1613 from OpenTechFund/fix/optimize-activity

Reduce DB queries for Activity
parents dc8780d8 6e969c0e
No related branches found
No related tags found
No related merge requests found
......@@ -18,16 +18,19 @@ class AllActivityContextMixin:
'user',
).prefetch_related(
'source',
'related_object',
)[:ACTIVITY_LIMIT],
'comments': Activity.comments.select_related(
'user',
).prefetch_related(
'source',
'related_object',
)[:ACTIVITY_LIMIT],
'all_activity': Activity.objects.select_related(
'user',
).prefetch_related(
'source',
'related_object',
)[:ACTIVITY_LIMIT],
}
return super().get_context_data(**extra, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment