Commit f81a95f4 by Hiago Rafael

sa fazendo umas coisas

parent a9722466
asdkgasfdy afsoudu gasyud asfld asn,dvbasb7yuamshv asoluyhas dluha v ,asbnd asluy from flask import Flask, render_template, request, redirect
\ No newline at end of file from models import Animal
app = Flask(__name__)
animais = []
@app.route('/')
def index():
return render_template('index.html', animais=animais)
@app.route('/adicionar', methods=['POST'])
def adicionar():
nome = request.form['nome']
tipo = request.form['tipo']
idade = request.form['idade']
novo_animal = Animal(nome, tipo, idade)
animais.append(novo_animal)
return redirect('/')
@app.route('/excluir/<int:id>')
def excluir(id):
if 0 <= id < len(animais):
animais.pop(id)
return redirect('/')
if __name__ == '__main__':
app.run(debug=True)
\ No newline at end of file
dklashd uiasdksajmbd sadkasudjfva snbd askdsaduasyfd askmndbs avkuyds vdkh asg fsd class Animal:
\ No newline at end of file def __init__(self, nome, tipo, idade):
self.nome = nome
self.tipo = tipo
self.idade = idade
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment