Skip to content
Snippets Groups Projects
Commit 585288f8 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add a limit to the returned activities

parent d95238c2
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,15 @@ from .forms import CommentForm
from .models import Activity, COMMENT
ACTIVITY_LIMIT = 50
class AllActivityContextMixin:
def get_context_data(self, **kwargs):
extra = {
'actions': Activity.actions.filter(submission__in=self.object_list),
'comments': Activity.comments.filter(submission__in=self.object_list),
'all_activity': Activity.objects.filter(submission__in=self.object_list),
'actions': Activity.actions.filter(submission__in=self.object_list)[:ACTIVITY_LIMIT],
'comments': Activity.comments.filter(submission__in=self.object_list[:ACTIVITY_LIMIT]),
'all_activity': Activity.objects.filter(submission__in=self.object_list)[: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