Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CRUD_Animais_da_Fazenda2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hiago Rafael
CRUD_Animais_da_Fazenda2
Commits
a2ee6857
Commit
a2ee6857
authored
May 07, 2026
by
Edvan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of
http://gitlab.ariquemes.ifro.edu.br/2024105070069/CRUD_Animais_da_Fazenda2
parents
6b04c397
14ac72de
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
29 deletions
+48
-29
cadastro.html
Template/cadastro.html
+23
-0
index.html
Template/index.html
+13
-23
models.cpython-314.pyc
__pycache__/models.cpython-314.pyc
+0
-0
app.py
app.py
+7
-2
models.py
models.py
+5
-4
No files found.
Template/cadastro.html
0 → 100644
View file @
a2ee6857
<!DOCTYPE html>
<html>
<head>
<title>
Cadastro
</title>
</head>
<body>
<h1>
Cadastrar Animal
</h1>
<form
action=
"/adicionar"
method=
"POST"
>
<input
type=
"text"
name=
"nome"
placeholder=
"Nome"
required
><br><br>
<input
type=
"text"
name=
"especie"
placeholder=
"Espécie"
required
><br><br>
<input
type=
"number"
name=
"idade"
placeholder=
"Idade"
required
><br><br>
<input
type=
"number"
step=
"0.1"
name=
"peso"
placeholder=
"Peso (kg)"
required
><br><br>
<button
type=
"submit"
>
Salvar
</button>
</form>
<br>
<a
href=
"/"
>
⬅ Voltar
</a>
</body>
</html>
\ No newline at end of file
Template/index.html
View file @
a2ee6857
<!DOCTYPE html>
<html
lang=
"pt-br"
>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
CRUD Animais da Fazenda
</title>
<title>
Lista de Animais
</title>
</head>
<body>
<h1>
Cadastro de Animais
</h1>
<h1>
Animais da Fazenda
</h1>
<form
action=
"/adicionar"
method=
"POST"
>
<input
type=
"text"
name=
"nome"
placeholder=
"Nome"
required
>
<input
type=
"text"
name=
"especie"
placeholder=
"Espécie"
required
>
<input
type=
"number"
name=
"idade"
placeholder=
"Idade"
required
>
<input
type=
"number"
step=
"0.1"
name=
"peso"
placeholder=
"Peso (kg)"
required
>
<button
type=
"submit"
>
Adicionar
</button>
</form>
<a
href=
"/cadastro"
>
➕ Novo Animal
</a>
<hr>
<h2>
Animais cadastrados
</h2>
<ul>
{% for animal in animais %}
<li>
{{ animal.nome }} - {{ animal.especie }} - {{ animal.idade }} anos - {{ animal.peso }} kg
<a
href=
"/excluir/{{ loop.index0 }}"
>
Excluir
</a>
</li>
{% endfor %}
</ul>
<ul>
{% for animal in animais %}
<li>
{{ animal.nome }} - {{ animal.especie }} - {{ animal.idade }} anos - {{ animal.peso }} kg
<a
href=
"/excluir/{{ loop.index0 }}"
>
❌ Excluir
</a>
</li>
{% endfor %}
</ul>
</body>
</html>
\ No newline at end of file
__pycache__/models.cpython-314.pyc
View file @
a2ee6857
No preview for this file type
app.py
View file @
a2ee6857
...
...
@@ -9,13 +9,18 @@ animais = []
def
index
():
return
render_template
(
'index.html'
,
animais
=
animais
)
@app.route
(
'/cadastro'
)
def
cadastro
():
return
render_template
(
'cadastro.html'
)
@app.route
(
'/adicionar'
,
methods
=
[
'POST'
])
def
adicionar
():
nome
=
request
.
form
[
'nome'
]
tipo
=
request
.
form
[
'tipo
'
]
especie
=
request
.
form
[
'especie
'
]
idade
=
request
.
form
[
'idade'
]
peso
=
request
.
form
[
'peso'
]
novo_animal
=
Animal
(
nome
,
tipo
,
idade
)
novo_animal
=
Animal
(
nome
,
especie
,
idade
,
peso
)
animais
.
append
(
novo_animal
)
return
redirect
(
'/'
)
...
...
models.py
View file @
a2ee6857
class
Animal
:
def
__init__
(
self
,
nome
,
tipo
,
idade
):
def
__init__
(
self
,
nome
,
especie
,
idade
,
peso
):
self
.
nome
=
nome
self
.
tipo
=
tipo
self
.
idade
=
idade
\ No newline at end of file
self
.
especie
=
especie
self
.
idade
=
idade
self
.
peso
=
peso
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment