def get_context_data(self, **kwargs): context = super(DashboardView, self).get_context_data(**kwargs) context["version"] = shuup.__version__ 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 get_context_data(self, **kwargs): context = super(DashboardView, self).get_context_data(**kwargs) context["version"] = shuup.__version__ context["notifications"] = notifications = [] context["blocks"] = blocks = [] for module in get_modules(): if not get_missing_permissions(self.request.user, module.get_required_permissions()): notifications.extend(module.get_notifications(request=self.request)) blocks.extend(module.get_dashboard_blocks(request=self.request)) context["activity"] = get_activity(request=self.request) context["tour_key"] = "dashboard" context["tour_complete"] = is_tour_complete("dashboard") return context
def get_context_data(self, **kwargs): context = super(DashboardView, self).get_context_data(**kwargs) context["version"] = shuup.__version__ context["notifications"] = notifications = [] context["blocks"] = blocks = [] for module in get_modules(): if not get_missing_permissions(self.request.user, module.get_required_permissions()): notifications.extend(module.get_notifications(request=self.request)) blocks.extend(module.get_dashboard_blocks(request=self.request)) # sort blocks by sort order and size, trying to make them fit better blocks.sort(key=lambda block: (block.sort_order, DashboardBlock.SIZES.index(block.size))) context["activity"] = get_activity(request=self.request) context["tour_key"] = "dashboard" context["tour_complete"] = is_tour_complete(get_shop(self.request), "dashboard", user=self.request.user) return context
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" ]
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"]