def get_context_data(self, **kwargs): self.logger.debug("displaying updates for user " + self.request.user.username) context = super(UpdatesView, self).get_context_data(**kwargs) notifications = ActionNotificationCheck.get_notifications_for_user(self.request.user) ActionNotificationCheck.update_for_user(self.request.user) context['notifications'] = notifications return context
def process_template_response(self, request, response): user = request.user self.logger.debug(user.is_authenticated()) if not user.is_authenticated(): return response self.logger.debug("get updates for user " + user.username) updates_no = ActionNotificationCheck.get_notifications_for_user(user) self.logger.debug("updates %d" % updates_no.count()) if updates_no.count() > 0: response.context_data['updates_no'] = "%d" % updates_no.count() else: response.context_data['updates_no'] = "0" return response