def add_build(request, p_id): project = Project.objects.get(id=p_id) if request.POST: version = request.POST['version'] description = request.POST['description'] new_build = Build(version=version, description=description, project=project) new_build.save() return HttpResponseRedirect('/project/get/' + str(project.id) + '/') else: raise PermissionDenied
def init_build(): if request.method == 'POST': path = request.form['path'] Logger.get().info("Pedido de testeo: %s" % (path, )) build = Build(path, g.user) build.save() datosjson = {"id": build.id, "path": build.path} Logger.get().info("Agregando pedido a cola de mensajes") beanstalk.put(json.dumps(datosjson)) else: Logger.get().info("Pedido de builds por el usuario %s" % (g.user.name, )) orderby = request.args.get('order', 'date') orderformat = request.args.get('list', 'desc') filterpath = request.args.get('path', None) filterfinished = request.args.get('finished', None) orderby = order_translate.get(orderby, Build.date) if orderformat == 'desc': orderby = orderby.desc() builds = Build.query.filter_by(user_id=g.user.id) if filterpath: builds = builds.filter_by(path=filterpath) if filterfinished: builds = builds.filter_by(finished=filterfinished) builds = builds.order_by(orderby).all() results = [] for bid in builds: results.append(bid.jsonrep(True)) return Response(json.dumps(results), status=200, mimetype="application/json") return jsonify(build.id)