Beispiel #1
0
    def GET(self):
        context = {}

        context["post_count"] = web.ctx.orm.query(Post).filter(Post.content_type == "post").count()
        context["comment_count"] = web.ctx.orm.query(Comment).count()
        # # context['spam_count']
        # context['category_count']   = web.ctx.orm.query(Term).filter(Term.type=='category')
        # context['tag_count'] = web.ctx.orm.query(Term).filter(Term.type=='tag')
        context["recent_comments"] = web.ctx.orm.query(Comment).order_by("comments.created DESC").all()[:5]

        return admin_render.index(**context)
Beispiel #2
0
 def GET(self):
     context = {}
     context["post_count"] = web.ctx.orm.query(Post).filter(Post.content_type == "post").count()
     context["comment_count"] = web.ctx.orm.query(Comment).count()
     context["spam_count"] = web.ctx.orm.query(Comment).filter(Comment.status == "spam").count()
     context["page_count"] = web.ctx.orm.query(Post).filter(Post.content_type == "page").count()
     context["category_count"] = web.ctx.orm.query(Term).filter(Term.type == "category").count()
     context["tag_count"] = web.ctx.orm.query(Term).filter(Term.type == "tag").count()
     context["recent_comments"] = (
         web.ctx.orm.query(Comment).order_by("comments.created DESC").all()[:5]
     )  # the recent 10 comments
     return admin_render.index(**context)