Exemple #1
0
 def get(self, *args):
     key = args[0]
     if key == "1":
         article_query = Article.get_all()
         page_size = 5
         #cur_page = self.get_argument("cur_page", int(math.ceil(article_query.count() / page_size)))
         cur_page = self.get_argument("cur_page", 1)
         article = pagination(count_all=article_query.count(), query=article_query, page_size=page_size,
                              cur_page=cur_page)
         self.render(
             'user/manager.html',
             article=article,
             users={},
             page_title="文章管理",
         )
     elif key == "2":
         user_query = User.get_all()
         page_size = 5
         cur_page = self.get_argument("cur_page", int(math.ceil(user_query.count() / page_size)))
         users = pagination(count_all=user_query.count(), query=user_query, page_size=page_size, cur_page=cur_page)
         self.render(
             'user/manager.html',
             article={},
             users=users,
             page_title="用户管理",
         )
     else:
         self.redirect("/manager/" + key)
Exemple #2
0
 def get(self, *args, **kwargs):
     cur_page = self.get_argument("cur_page", "1")
     article_query = Article.get_all()
     article = pagination(count_all=article_query.count(), query=article_query, page_size=5, cur_page=cur_page)
     self.render(
         'community.html',
         article=article,
     )