예제 #1
0
파일: web_run.py 프로젝트: jk409/python3
 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)
예제 #2
0
파일: web_run.py 프로젝트: jk409/python3
    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)
예제 #3
0
파일: web_run.py 프로젝트: jk409/python3
 def get(self):
     res = sql.cmd('select * from blog;')
     res_list = [list(i) for i in res]
     self.render('xml.html',lists = res_list)
예제 #4
0
파일: web_run.py 프로젝트: jk409/python3
 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)
예제 #5
0
파일: web_run.py 프로젝트: jk409/python3
 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)
예제 #6
0
파일: web_run.py 프로젝트: jk409/python3
 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)
예제 #7
0
파일: web_run.py 프로젝트: jk409/python3
 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)
예제 #8
0
파일: web_run.py 프로젝트: jk409/python3
 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)