def delete_reino(idreino): reino = Reino.find_by_id(idreino) if reino is not None: Reino.delete(idreino) b = Response() b.set_data("apagado id= {}".format(idreino)) b.status = "200" b.get_json(force=False, silent=True, cache=True) b.mimetype = "application/xml" return b.get_data()
def edit_reino(idreino=None): reino = Reino.find_by_id(idreino) if reino is not None: if request.method == 'POST': reino_form = request.form['reino'] Reino.editar(idreino, reino_form) return redirect(url_for(".reinos")) return render_template("reino/edit_reino.html", reino=reino[1]) return redirect(url_for(".reinos"))
def reino_add(): if request.method == "POST": reino = request.form['reino'] if Reino(reino).insert(): return redirect(url_for(".reinos")) return render_template("reino/register_reino.html")
def buscar_reino(reino): ret_reino = Reino.find_by_name(reino) if ret_reino is not None: data = Database.find_one('idFilo, filo', coleccao, " idReino= {} ".format(ret_reino[0])) if data is not None: return data
def filo_add(): if request.method == 'POST': filo = request.form['filo'] idreino = request.form['reino'] if Filo(filo,idreino).insert(): print(idreino) return redirect(url_for(".filos")) reinos = Reino.find_all() return render_template("filo/register_filo.html", reinos = reinos)
def classe_add(): if request.method == 'POST': classe = request.form['classe'] idfilo = request.form['filo'] if Classe(classe, idfilo).insert(): return redirect(url_for(".classes")) filos = Filo.find_all() reinos = Reino.find_all() return render_template("classe/register_classe.html", reinos=reinos, filos=filos)
def filos(): data = Filo.find_all() reino = Reino.find_all() return render_template("filo/filos.html", data=data, reino=reino)
def reinos(): data = Reino.find_all() return render_template("reino/reinos.html", data=data)