def GET(self, id, page=1): account_info = model.get_account(int(id)) for info in account_info: page = int(page) perpage = 13 offset = (page - 1) * perpage posts = model.get_list(info.account_id, offset, perpage) postcount = model.get_list_num(info.account_id) pages = postcount.count / perpage if postcount.count % perpage != 0: total = 1 + pages total = pages lastpage = int(page) - 1 nextpage = int(page) + 1 page3 = [] total = pages for p in range(0, 6): page3.append(p + int(page)) if page > pages: raise web.seeother('/account/$id/$total') return render.account(id, posts=posts, pages=page3, total=total, lastpage=lastpage, nextpage=nextpage)
def list(cls): num = int(request.args.get("num")) count = int(request.args.get("count")) if count > 20: return render_template('404.html') result = get_list(num, count, cls) list = [] sum = get_count(cls) for item in result: list.append({ 'id': item['id'], 'title': chs_to_cht(item['title']), 'class': item['class'], 'digest': chs_to_cht(item['digest']), 'cover': item['cover'] }) all_page_name = int(sum / count) + 1 if all_page_name > 20: all_page_name = 20 data = { 'list': list, 'count': all_page_name, 'cls': cls, 'pageNum': num, } return render_template('list.html', data=data)
def list(): # List page page = int(request.args['p']) if 'p' in request.args else 1 log_access('list', 'page: ' + str(page)) page = page if page >= 1 else 1 return render_template('list.html', records = model.get_list(page), pagination = pagination(page))
def GET(self,id,page=1): account_info = model.get_account(int(id)) for info in account_info: page = int(page) perpage = 13 offset = (page -1) * perpage posts = model.get_list(info.account_id,offset,perpage) postcount = model.get_list_num(info.account_id) pages= postcount.count / perpage if postcount.count % perpage != 0: total = 1+pages total = pages lastpage = int(page)-1 nextpage = int(page)+1 page3=[] total=pages for p in range(0,6): page3.append(p+int(page)) if page > pages: raise web.seeother('/account/$id/$total') return render.account(id,posts=posts,pages=page3,total=total,lastpage=lastpage,nextpage=nextpage)
def GET(self,id): account_info = model.get_account(int(id)) for info in account_info: list = model.get_list(info.account_id) return render.rss(list)
def game(): props = { "letter": random.choice(string.ascii_letters), "categories": model.get_list() } return render_template("game.html", props=props, time=datetime.now())
def GET(self, id): account_info = model.get_account(int(id)) for info in account_info: list = model.get_list(info.account_id) return render.rss(list)
def get_list(): return jsonify(rows=m.get_list(g.user_id))
def dashboard(): user = session['username'] list_dictionary = model.get_list(user) return render_template('dashboard.html', list_dictionary=list_dictionary)