def get_content_stats(template='admin/entry/widgets/_content_stats.html'): """Return statistics of the contents""" content_type = ContentType.objects.get_for_model(Entry) discussions = Comment.objects.filter(is_public=True, content_type=content_type) return { 'template': template, 'entries': Entry.published.count(), 'categories': Category.objects.count(), 'tags': tags_published().count(), 'authors': Author.published.count(), 'comments': discussions.filter(flags=None).count(), 'pingbacks': discussions.filter(flags__flag='pingback').count(), 'trackbacks': discussions.filter(flags__flag='trackback').count(), 'rejects': Comment.objects.filter(is_public=False, content_type=content_type).count(), }
def get_content_stats( template='admin/entry/widgets/_content_stats.html'): """Return statistics of the contents""" content_type = ContentType.objects.get_for_model(Entry) discussions = Comment.objects.filter( is_public=True, content_type=content_type) return {'template': template, 'entries': Entry.published.count(), 'categories': Category.objects.count(), 'tags': tags_published().count(), 'authors': Author.published.count(), 'comments': discussions.filter(flags=None).count(), 'pingbacks': discussions.filter(flags__flag='pingback').count(), 'trackbacks': discussions.filter(flags__flag='trackback').count(), 'rejects': Comment.objects.filter( is_public=False, content_type=content_type).count(), }
def items(self): """Return all tags with coeff""" tags = tags_published() self.cache(tags) return tags