def index(*, page='1'): page_index = get_page_index(page) num = yield from Activities.findNumber('count(id)',where="state = '1'") page = Page(num) if num == 0: activities = [] else: activities = yield from Activities.findAll(where="state='1'", orderBy='created_at desc', limit=(page.offset, page.limit)) return { '__template__': 'activities_index.html', 'page': page, 'activities': activities }
def manage_activites(request,*,page='1'): page_index = get_page_index(page) num = yield from Activities.findNumber('count(id)') page = Page(num,page_index) if num == 0: activities = [] else: activities = yield from Activities.findAll(orderBy='created_at desc', limit=(page.offset, page.limit)) return { '__template__': 'manage_activities.html', 'page':page, 'activities':activities }