code: def paginate(self, page=1, perpage=10, category=None):
          
          q = db.select(self.table).fields('title', 'slug', 'description', 'html', 'css', 'js',
                                           'category', 'status', 'comments', 'author', 'created', 'pid')
          if category:
              q.condition('category', category)
          results = (q.limit(perpage).offset((page - 1) * perpage)
                      .order_by('created', 'DESC').execute())
          return [self.load(data, self.model) for data in results]
docs: Paginate the posts