Esempio n. 1
0
 def lumpedit(self):
     id = self.get_argument('id', '0')
     lump = LumpModel.mgr().Q().filter(id=id)[0];
     categorys = LumpCategoryModel.mgr().Q()
     self.render('lump/edit.html',
                 lump=lump,
                 categorys=categorys);
Esempio n. 2
0
 def lumpdelete(self):
     ids = str(self.get_argument('ids')).split(",")
     for id in ids:
         lumps = LumpModel.mgr().Q().filter(id=id)
         if lumps:
             for lump in lumps:
                 lump.delete()
     self.write(json.dumps({'statusCode': "200",
                            'callbackType': "forward",
                            'navTabId': "lump",
                            'forwardUrl': "/admin/lumplist"}))
Esempio n. 3
0
 def delete(self):
     lid = int(self.get_argument('id'))
     lumps = LumpModel.mgr(ismaster=1).Q().filter(id=lid)
     if lumps:
         for lump in lumps:
             lump.delete()
     res = dict()
     res['result'] = {}
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res)
     self.write(jsondata)
Esempio n. 4
0
 def delete(self):
     lid = int(self.get_argument('id'))
     lumps = LumpModel.mgr(ismaster=1).Q().filter(id=lid)
     if lumps:
         for lump in lumps:
             lump.delete()
     res = dict()
     res['result'] = {}
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res)
     self.write(jsondata)
Esempio n. 5
0
 def lumpdelete(self):
     ids = str(self.get_argument('ids')).split(",")
     for id in ids:
         lumps = LumpModel.mgr().Q().filter(id=id)
         if lumps:
             for lump in lumps:
                 lump.delete()
     self.write(
         json.dumps({
             'statusCode': "200",
             'callbackType': "forward",
             'navTabId': "lump",
             'forwardUrl': "/admin/lumplist"
         }))
Esempio n. 6
0
 def lumplist(self):
     # 列表的当前页,默认在第一页
     currentPage = int(self.get_argument('pageNum', 1))
     # 列表中每页显示多少条,默认每页显示20条
     numPerPage = int(self.get_argument('numPerPage', 20))
     # 计算User的总数
     all = LumpModel.mgr().Q().orderby('sort', 'desc')
     totalCount = len(all)
     lumps = all[(currentPage - 1) * numPerPage: currentPage * numPerPage]
     categorys = LumpCategoryModel.mgr().Q()
     print 'lumplist numPerPage:%d' % numPerPage
     self.render('lump/list.html',
                 lumps=lumps,
                 categorys=categorys,
                 currentPage=currentPage,
                 numPerPage=numPerPage,
                 totalCount=totalCount);
Esempio n. 7
0
 def lumplist(self):
     # 列表的当前页,默认在第一页
     currentPage = int(self.get_argument('pageNum', 1))
     # 列表中每页显示多少条,默认每页显示20条
     numPerPage = int(self.get_argument('numPerPage', 20))
     # 计算User的总数
     all = LumpModel.mgr().Q().orderby('sort', 'desc')
     totalCount = len(all)
     lumps = all[(currentPage - 1) * numPerPage:currentPage * numPerPage]
     categorys = LumpCategoryModel.mgr().Q()
     print 'lumplist numPerPage:%d' % numPerPage
     self.render('lump/list.html',
                 lumps=lumps,
                 categorys=categorys,
                 currentPage=currentPage,
                 numPerPage=numPerPage,
                 totalCount=totalCount)
Esempio n. 8
0
 def list(self):
     size = int(self.get_argument('size', '10'))
     page = int(self.get_argument('page', '0'))
     if page == 0:
         page = 0
     if size == 0:
         size = 10
     sql = 'select `id`,`name` from monitor_lumpCategory order by sort desc limit %d,%d' % (page * size, size);
     categorys = LumpCategoryModel.mgr().raw(sql)
     for category in categorys:
         lumpsql = 'select `id`,`name`,`desc`,`iconUrl`,`url` from monitor_lump where categoryId=%d order by sort desc' % category['id']
         lumps = LumpModel.mgr().raw(lumpsql)
         for lump in lumps:
             iconUrl = lump['iconUrl']
             if iconUrl.startswith('/static/images/'):
                 lump['iconUrl'] = SERVER_ADDRESS + iconUrl
         category['lumps'] = lumps
     print categorys
     self.send_json(categorys, 0, '成功')
Esempio n. 9
0
 def list(self):
     size = int(self.get_argument('size', '10'))
     page = int(self.get_argument('page', '0'))
     if page < 0:
         page = 0
     if size <= 0:
         size = 10
     sql = 'select * from monitor_lump order by sort desc limit %d,%d' % (page * size, size);
     lumps = LumpModel.mgr().raw(sql)
     for lump in lumps:
         iconUrl = lump['iconUrl']
         if iconUrl.startswith('/static/images/'):
             lump['iconUrl'] = SERVER_ADDRESS + iconUrl
     res = {}
     res['result'] = lumps
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res, cls=CJsonEncoder)
     self.write(jsondata)
Esempio n. 10
0
 def list(self):
     size = int(self.get_argument('size', '10'))
     page = int(self.get_argument('page', '0'))
     if page < 0:
         page = 0
     if size <= 0:
         size = 10
     sql = 'select * from monitor_lump order by sort desc limit %d,%d' % (
         page * size, size)
     lumps = LumpModel.mgr().raw(sql)
     for lump in lumps:
         iconUrl = lump['iconUrl']
         if iconUrl.startswith('/static/images/'):
             lump['iconUrl'] = SERVER_ADDRESS + iconUrl
     res = {}
     res['result'] = lumps
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res, cls=CJsonEncoder)
     self.write(jsondata)
Esempio n. 11
0
 def list(self):
     size = int(self.get_argument('size', '10'))
     page = int(self.get_argument('page', '0'))
     if page == 0:
         page = 0
     if size == 0:
         size = 10
     sql = 'select `id`,`name` from monitor_lumpCategory order by sort desc limit %d,%d' % (
         page * size, size)
     categorys = LumpCategoryModel.mgr().raw(sql)
     for category in categorys:
         lumpsql = 'select `id`,`name`,`desc`,`iconUrl`,`url` from monitor_lump where categoryId=%d order by sort desc' % category[
             'id']
         lumps = LumpModel.mgr().raw(lumpsql)
         for lump in lumps:
             iconUrl = lump['iconUrl']
             if iconUrl.startswith('/static/images/'):
                 lump['iconUrl'] = SERVER_ADDRESS + iconUrl
         category['lumps'] = lumps
     print categorys
     self.send_json(categorys, 0, '成功')
Esempio n. 12
0
 def lumpedit(self):
     id = self.get_argument('id', '0')
     lump = LumpModel.mgr().Q().filter(id=id)[0]
     categorys = LumpCategoryModel.mgr().Q()
     self.render('lump/edit.html', lump=lump, categorys=categorys)