def listarAcumuladores(): limit = int(request.args['rp']) page = int(request.args['page']) skip = (page - 1) * limit qtype = request.args['qtype'] query = request.args['query'] if len(query) > 0: if (str(qtype) == 'of'): qquery = TestAcumuladores.objects(of__contains=query) else: qquery = TestAcumuladores.objects(operario__contains=int(query)) else: qquery = TestAcumuladores.objects.all() total = qquery.count() datos = qquery.skip(skip).limit(limit) l = [] for dato in datos: l.append(dato.to_dict()) d = JSONWrapper(l) d.total = total d.page = page return jsonify(page=d.page, total=d.total, rows=d.rows)
def testAcumuladores(): #app.logger.info("TESTEAR ACUMULADORES") if request.method == 'GET': #app.logger.info("\tGET") return render_template("TestAcumuladores.html") else: #app.logger.info("\tPOST") test = TestAcumuladores() if validarDatosAcumuladores(request, test): #app.logger.info("\tDATOS VALIDOS") test.testear() #app.logger.info(test) test.save() return render_template("TestAcumuladores.html", test=test)