Ejemplo n.º 1
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        start = (int(page) - 1) * int(rows)
        limit = rows
        rows = NewsCategory.gets(start, limit)
        rows = [obj2dict(r) for r in rows]
        total = NewsCategory.get_count()
        response = {'total': total, 'rows': rows}
        return self.write(date_encode(response))
Ejemplo n.º 2
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        start = (int(page) - 1) * int(rows)
        limit = rows
        rows = NewsCategory.gets(start, limit)
        rows = [obj2dict(r) for r in rows]
        total = NewsCategory.get_count()
        response = {'total': total, 'rows': rows}
        return self.write(date_encode(response))
Ejemplo n.º 3
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        start = (int(page) - 1) * int(rows)
        limit = rows
        user_list = User.gets(start, limit)
        total = User.get_count()

        response = {'total': total, 'rows': user_list}
        return self.write(date_encode(response))
Ejemplo n.º 4
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        start = (int(page) - 1) * int(rows)
        limit = rows
        user_list = User.gets(start, limit)
        total = User.get_count()

        response = {
            'total': total,
            'rows': user_list
        }
        return self.write(date_encode(response))
Ejemplo n.º 5
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        title = self.get_argument('title', '')
        begin = self.get_argument('begin', '')
        end = self.get_argument('end', '')

        query = {}
        if title:
            query['title'] = title
        if begin:
            query['begin'] = begin
        if end:
            query['end'] = end

        offset = (int(page) - 1) * int(rows)
        limit = rows
        rows = News.gets(offset, limit, **query)
        rows = [obj2dict(r) for r in rows]
        total = News.get_count()

        response = {'total': total, 'rows': rows}
        return self.write(date_encode(response))
Ejemplo n.º 6
0
    def get(self):
        page = self.get_argument('page', 1)
        rows = self.get_argument('rows', 20)

        title = self.get_argument('title', '')
        begin = self.get_argument('begin', '')
        end = self.get_argument('end', '')

        query = {}
        if title:
            query['title'] = title
        if begin:
            query['begin'] = begin
        if end:
            query['end'] = end

        offset = (int(page) - 1) * int(rows)
        limit = rows
        rows = News.gets(offset, limit, **query)
        rows = [obj2dict(r) for r in rows]
        total = News.get_count()

        response = {'total': total, 'rows': rows}
        return self.write(date_encode(response))