Пример #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);
Пример #2
0
 def categorydelete(self):
     ids = str(self.get_argument('ids')).split(",")
     for id in ids:
         categorys = LumpCategoryModel.mgr().Q().filter(id=id)
         if categorys:
             for category in categorys:
                 category.delete()
     self.write(json.dumps({'statusCode': "200",
                            'callbackType': "forward",
                            'navTabId': "category",
                            'forwardUrl': "/admin/categorylist"}))
Пример #3
0
 def delete(self):
     cid = int(self.get_argument('id'))
     categorys = LumpCategoryModel.mgr(ismaster=1).Q().filter(id=cid)
     if categorys:
         for category in categorys:
             category.delete()
     res = dict()
     res['result'] = {}
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res)
     self.write(jsondata)
Пример #4
0
 def delete(self):
     cid = int(self.get_argument('id'))
     categorys = LumpCategoryModel.mgr(ismaster=1).Q().filter(id=cid)
     if categorys:
         for category in categorys:
             category.delete()
     res = dict()
     res['result'] = {}
     res['code'] = 0
     res['msg'] = '成功'
     jsondata = json.dumps(res)
     self.write(jsondata)
Пример #5
0
 def categorylist(self):
     # 列表的当前页,默认在第一页
     currentPage = int(self.get_argument('pageNum', 1))
     # 列表中每页显示多少条,默认每页显示20条
     numPerPage = int(self.get_argument('numPerPage', 20))
     # 计算User的总数
     all = LumpCategoryModel.mgr().Q().orderby('sort', 'desc')
     totalCount = len(all)
     categorys = all[(currentPage - 1) * numPerPage: currentPage * numPerPage]
     self.render('category/list.html',
                 categorys=categorys,
                 currentPage=currentPage,
                 numPerPage=numPerPage,
                 totalCount=totalCount);
Пример #6
0
 def categorydelete(self):
     ids = str(self.get_argument('ids')).split(",")
     for id in ids:
         categorys = LumpCategoryModel.mgr().Q().filter(id=id)
         if categorys:
             for category in categorys:
                 category.delete()
     self.write(
         json.dumps({
             'statusCode': "200",
             'callbackType': "forward",
             'navTabId': "category",
             'forwardUrl': "/admin/categorylist"
         }))
Пример #7
0
 def categorylist(self):
     # 列表的当前页,默认在第一页
     currentPage = int(self.get_argument('pageNum', 1))
     # 列表中每页显示多少条,默认每页显示20条
     numPerPage = int(self.get_argument('numPerPage', 20))
     # 计算User的总数
     all = LumpCategoryModel.mgr().Q().orderby('sort', 'desc')
     totalCount = len(all)
     categorys = all[(currentPage - 1) * numPerPage:currentPage *
                     numPerPage]
     self.render('category/list.html',
                 categorys=categorys,
                 currentPage=currentPage,
                 numPerPage=numPerPage,
                 totalCount=totalCount)
Пример #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, '成功')
Пример #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 `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, '成功')
Пример #10
0
 def lumpadd(self):
     categorys = LumpCategoryModel.mgr().Q()
     print 'categorys'
     print categorys
     self.render('lump/add.html',
                 categorys=categorys);
Пример #11
0
 def categoryedit(self):
     id = self.get_argument('id', '0')
     category = LumpCategoryModel.mgr().Q().filter(id=id)[0];
     self.render('category/edit.html',
                 category=category);
Пример #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)
Пример #13
0
 def lumpadd(self):
     categorys = LumpCategoryModel.mgr().Q()
     print 'categorys'
     print categorys
     self.render('lump/add.html', categorys=categorys)
Пример #14
0
 def categoryedit(self):
     id = self.get_argument('id', '0')
     category = LumpCategoryModel.mgr().Q().filter(id=id)[0]
     self.render('category/edit.html', category=category)