Example #1
0
 def get(self, pageId):
     p = Paginator(Article.all(self.db), 5)
     page = p.page(int(pageId))
     isAdmin = self.isAdmin()
     label_list = Label.group(self.db)
     self.render('index.html', articles=page.object_list, label_list=label_list,
             isAdmin=isAdmin, page=page, home_title=options.home_title,
             user=options.user, photo=options.photo)
Example #2
0
    def get(self):
        key = self.get_argument('key', '').strip()
        pageId = int(self.get_argument('page', '1'))
        if len(key) == 0:
            results = Article.all(self.db)
        else:
            results = Search.all(self.db, key)
        p = Paginator(results, 5)
        page = p.page(pageId)
        isAdmin = self.isAdmin()
        label_list = Label.group(self.db)

        self.render('search.html', articles=page.object_list, label_list=label_list,
                isAdmin=isAdmin, page=page, home_title=options.home_title,
                user=options.user, photo=options.photo)