예제 #1
0
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()
예제 #2
0
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"))
예제 #3
0
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")
예제 #4
0
    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
예제 #5
0
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)
예제 #6
0
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)
예제 #7
0
def filos():
    data = Filo.find_all()
    reino = Reino.find_all()
    return render_template("filo/filos.html", data=data, reino=reino)
예제 #8
0
def reinos():
    data = Reino.find_all()
    return render_template("reino/reinos.html", data=data)