Пример #1
0
    def get(self, page):
        # 获取bookmark
        self.page = int(page or 1)
        self.bookmarks, self.page_count = Bookmark.get_by_page(self.page)

        if self.page > self.page_count:
            # url要求的页数超出了总页数
            self.redirect('/main/' + str(self.page_count))
            return

        # 获取tag
        self.tags = Tag.get_all_tags()

        self.render('main.html', title=self.page_count, contents={
            'bookmarks': self.bookmarks, 'tags': self.tags})
Пример #2
0
    def get(self, tag_names, page):
        # 获取页数
        self.page = int(page or 1)

        # 获取tag列表
        self.tags = tag_names.replace('+', ' ').split()
        self.bookmarks, self.page_count = \
                Bookmark.get_by_tags(self.tags, self.page)

        if self.page > self.page_count:
            # url要求的页数超出了总页数
            self.redirect('/tag/{0}/{1}'.format(
                '+'.join(self.tags), self.page_count))
            return

        self.tags = Tag.get_all_tags()

        self.render('filter.html', title=tag_names, contents={
            'bookmarks': self.bookmarks, 'tags': self.tags})
Пример #3
0
 def get(self):
     self.tags = Tag.get_all_tags()
     self.render('dashboard.html', title='dashboard', contents=self.tags)