Ejemplo n.º 1
0
 def get(self, *args, **kwargs):
     blogid = kwargs["blogid"]
     nav = 1
     args = {}
     blog = BlogInfo().get(id=blogid)
     if not blog:
         raise HTTPError(404)
     blog["createtime"] = time_format(blog["createtime"], "%Y-%m-%d")
     BlogInfo().update("id=%s" % blog["id"], view_count=blog["view_count"] + 1)
     bloglist = BlogInfo().limit(7).filter(**args)
     bloglist = Format.format_blog_list(bloglist)
     self.render("default/web-blog-detail.html", nav=nav, blog=blog, bloglist=bloglist)
Ejemplo n.º 2
0
 def get(self, *args, **kwargs):
     args = {}
     args["user"] = self.current_user["id"]
     page = int(self.get_argument("p",1))
     pagesize = 10
     bloglist = BlogInfo().limit(pagesize,(page -1) * pagesize).filter(**args)
     counts = BlogInfo().counts(**args)
     bloglist = Format.format_blog_list(bloglist)
     # 分页
     page_html = self.get_page_html(counts,pagesize)
     nav = 2
     self.render("default/web-myblog.html", nav=nav, bloglist=bloglist,page_html=page_html)
Ejemplo n.º 3
0
 def get(self, *args, **kwargs):
     #self.write(self.request.host)
     args = {}
     page = int(self.get_argument("p",1))
     pagesize = 10
     bloglist = BlogInfo().limit(pagesize,(page -1) * pagesize).filter(**args)
     bloglist = Format.format_blog_list(bloglist)
     counts = BlogInfo().counts(**args)
     # 分页
     page_html = self.get_page_html(counts,pagesize)
     nav = 1
     self.render("default/web-index.html", nav=nav,bloglist=bloglist,page_html=page_html)
Ejemplo n.º 4
0
 def get(self, *args, **kwargs):
     blogid = kwargs["blogid"]
     nav = 1
     args = {}
     blog = BlogInfo().get(id=blogid)
     if not blog:
         raise HTTPError(404)
     blog["createtime"] = time_format(blog["createtime"], "%Y-%m-%d")
     BlogInfo().update("id=%s" % blog["id"],
                       view_count=blog["view_count"] + 1)
     bloglist = BlogInfo().limit(7).filter(**args)
     bloglist = Format.format_blog_list(bloglist)
     self.render("default/web-blog-detail.html",
                 nav=nav,
                 blog=blog,
                 bloglist=bloglist)
Ejemplo n.º 5
0
 def get(self, *args, **kwargs):
     args = {}
     args["user"] = self.current_user["id"]
     page = int(self.get_argument("p", 1))
     pagesize = 10
     bloglist = BlogInfo().limit(pagesize,
                                 (page - 1) * pagesize).filter(**args)
     counts = BlogInfo().counts(**args)
     bloglist = Format.format_blog_list(bloglist)
     # 分页
     page_html = self.get_page_html(counts, pagesize)
     nav = 2
     self.render("default/web-myblog.html",
                 nav=nav,
                 bloglist=bloglist,
                 page_html=page_html)
Ejemplo n.º 6
0
 def get(self, *args, **kwargs):
     #self.write(self.request.host)
     args = {}
     page = int(self.get_argument("p", 1))
     pagesize = 10
     bloglist = BlogInfo().limit(pagesize,
                                 (page - 1) * pagesize).filter(**args)
     bloglist = Format.format_blog_list(bloglist)
     counts = BlogInfo().counts(**args)
     # 分页
     page_html = self.get_page_html(counts, pagesize)
     nav = 1
     self.render("default/web-index.html",
                 nav=nav,
                 bloglist=bloglist,
                 page_html=page_html)