def get(self): res_list = [] page_list=[] page_size = 5 global page pag_num = self.get_argument('pag_num','0') page = page+int(pag_num) page_count=sql.cmd("select count(id) from blog") for i in page_count: page_count= int(i[0]) if page <=0: page = 0 elif page*page_size > page_count: page=page-1 sqls="select * from blog where id order by date desc limit %s,%s"%(page*page_size,page_size) res = sql.cmd(sqls) res_list = [list(i) for i in res] #res_list.reverse() self.render('blog.html', lists = res_list)
def get(self): res_list = [] page_list=[] page_size = 5 #每页的条数 global page pag_num = self.get_argument('pag_num','0') page = page+int(pag_num) #当前页数 page_count=sql.cmd("select count(id) from blog") for i in page_count: page_count= int(i[0]) #获取总条数 pages=math.ceil(page_count/5) #总页数 if page <= 1: page = 1 elif (page-1)*page_size > page_count: page=page-1 sqls="select * from blog where id order by date desc limit %s,%s"%((page-1)*page_size,page_size) res = sql.cmd(sqls) res_list = [list(i) for i in res] #res_list.reverse() self.render('blogs.html', lists = res_list,page_count=pages,page=page)
def get(self): res = sql.cmd('select * from blog;') res_list = [list(i) for i in res] self.render('xml.html',lists = res_list)
def get(self,ids): res_list = [] res = sql.cmd('select * from blog where id=%s;'% ids) res_list = [list(i) for i in res] self.render('blog_edit.html', lists = res_list)
def get(self,fl): res_list = [] res = sql.cmd("select * from blog where fl='%s' order by date desc "%(fl)) res_list = [list(i) for i in res] self.render('blog.html', lists = res_list)
def get(self): res_list = [] res = sql.cmd('select * from blog;') res_list = [list(i) for i in res] self.render('blog_add.html', lists=res_list)
def get(self, fl): res_list = [] res = sql.cmd("select * from blog where fl='%s' order by date desc " % (fl)) res_list = [list(i) for i in res] self.render('blog.html', lists=res_list)
def get(self, ids): res_list = [] res = sql.cmd('select * from blog where id=%s' % ids) res_list = [list(i) for i in res] self.render('blog.html', lists=res_list)