Exemplo n.º 1
0
 def screenSort():
     # params =Requester(request)
     foreign = getSheet().get("foreign", [])
     params, orderBy = factoryDB(pops="id"), "order by number ASC,id DESC"
     sort, data = params.requester.value("sort"), params.model.find(
         "*", clause=orderBy).get("data", [])
     data = data[::-1] if sort == "reverse" else data
     print(">>>>>>>>>>>sort>>>>>>>>>>", data)
     for i, v in enumerate(data):
         params.model.update({"number": i + 1},
                             clause="where id={0}".format(v["id"]))
     # params.updateById(orderBy="order by number ASC,id DESC")
     return json.dumps(params.findBy(foreign, orderBy=orderBy))
Exemplo n.º 2
0
 def screenDelete():
     foreign = getSheet().get("foreign", [])
     params = factoryDB(pops="id", byNames=foreign)
     return json.dumps(
         params.deleteById(orderBy="order by number ASC,id DESC"))
Exemplo n.º 3
0
 def screenList():
     foreign = getSheet().get("foreign", [])
     params = factoryDB(pops="id")
     return json.dumps(
         params.findBy(foreign, orderBy="order by number ASC,id DESC"))