From 4895b3d7e317955e3ae956226521943acebce40b Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Mon, 22 May 2017 12:17:47 +0000 Subject: [PATCH] Limit user events to 5 in profile view --- pootle/apps/pootle_profile/templatetags/profile_tags.py | 2 +- pootle/apps/pootle_profile/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pootle/apps/pootle_profile/templatetags/profile_tags.py b/pootle/apps/pootle_profile/templatetags/profile_tags.py index 313aad7388f..56c7fb231a3 100644 --- a/pootle/apps/pootle_profile/templatetags/profile_tags.py +++ b/pootle/apps/pootle_profile/templatetags/profile_tags.py @@ -146,7 +146,7 @@ def profile_activity(profile, request_lang=None): context = dict(profile=profile) if profile.user.is_meta: return context - context["user_events"] = context["profile"].get_events() + context["user_events"] = context["profile"].get_events(n=5) context["user_last_event"] = ( context["profile"].user.last_event(locale=request_lang)) return context diff --git a/pootle/apps/pootle_profile/utils.py b/pootle/apps/pootle_profile/utils.py index 8eb83d295b1..3d182d862cc 100644 --- a/pootle/apps/pootle_profile/utils.py +++ b/pootle/apps/pootle_profile/utils.py @@ -68,7 +68,7 @@ def get_events(self, start=None, n=None): else: _events.append(formatters.get("group")(self.user, evs)) if n is not None: - events = events[-n:] + _events = _events[-n:] return reversed(_events)