def render(self, context): user = context['user'] params = {} if not user.is_superuser: params.update({'user': user}) context[self.varname] = get_log_entries(limit=self.limit, filters=params) return ''
def log_view(self, request, extra_context=None): self.register_newman_variables(request) ct = ContentType.objects.get_for_model(self.model) if ct.model_class() == Publishable: publishable_cts = [] cts = ContentType.objects.all() for ctc in cts: if ctc.model_class() and issubclass(ctc.model_class(), Publishable): publishable_cts.append(ctc.id) params= {'content_type__in': publishable_cts} else: params = {'content_type': ct} if not request.user.is_superuser: params.update({'user': request.user}) entries = utils.get_log_entries(limit=15, filters=params) context = {'entry_list': entries, 'ct': ct} return render_to_response(self.get_template_list('action_log.html'), context, context_instance=template.RequestContext(request))