def get_context_data(self, **kwargs): context = super(DashboardView, self).get_context_data(**kwargs) context["notifications"] = notifications = [] context["blocks"] = blocks = [] for module in get_modules(): notifications.extend(module.get_notifications(request=self.request)) blocks.extend(module.get_dashboard_blocks(request=self.request)) context["activity"] = get_activity(request=self.request) return context
def test_activity(rf): with replace_modules([TestModule]): request = rf.get("/") texts = [a.text for a in get_activity(request, 10)] # Check that activity is returned in newest-first order. assert texts == ["Latest", "Later", "Earlier", "Earliest" ]
def test_activity(rf): with replace_modules([ATestModule]): request = rf.get("/") texts = [a.text for a in get_activity(request, 10)] # Check that activity is returned in newest-first order. assert texts == ["Latest", "Later", "Earlier", "Earliest" ]