Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CRUD_Animais_da_Fazenda
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
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_Fazenda
Commits
699db5da
Commit
699db5da
authored
Apr 16, 2026
by
bricioso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fiz login basico
parent
72fb1b68
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
app.py
Python/app.py
+7
-14
login.html
Python/templates/login.html
+6
-0
No files found.
Python/app.py
View file @
699db5da
...
@@ -36,17 +36,20 @@ with app.app_context():
...
@@ -36,17 +36,20 @@ with app.app_context():
@app.route
(
'/'
)
@app.route
(
'/'
)
def
login
():
def
login
():
return
render_template
(
'login.html'
)
# Como você ainda não tem o login.html, vamos abrir a lista direto
# para você testar se o banco está funcionando!
return
redirect
(
url_for
(
'index'
))
@app.route
(
'/catalogo'
)
@app.route
(
'/catalogo'
)
def
index
():
def
index
():
animais
=
Animal
.
query
.
all
()
animais
=
Animal
.
query
.
all
()
#
Verifique se seu arquivo se chama index.html ou lista
.html
#
No seu print o arquivo se chama lista.html, não index
.html
return
render_template
(
'
index
.html'
,
animais
=
animais
)
return
render_template
(
'
lista
.html'
,
animais
=
animais
)
@app.route
(
'/cadastro_animal'
,
methods
=
[
'GET'
,
'POST'
])
@app.route
(
'/cadastro_animal'
,
methods
=
[
'GET'
,
'POST'
])
def
cadastro_animal
():
def
cadastro_animal
():
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
# Pega os dados do formulário do Hiago
novo
=
Animal
(
novo
=
Animal
(
nome
=
request
.
form
[
'nome'
],
nome
=
request
.
form
[
'nome'
],
especie
=
request
.
form
[
'especie'
],
especie
=
request
.
form
[
'especie'
],
...
@@ -72,13 +75,3 @@ def cadastro_pessoa():
...
@@ -72,13 +75,3 @@ def cadastro_pessoa():
db
.
session
.
commit
()
db
.
session
.
commit
()
return
redirect
(
url_for
(
'index'
))
return
redirect
(
url_for
(
'index'
))
return
render_template
(
'cadastro_pessoa.html'
)
return
render_template
(
'cadastro_pessoa.html'
)
\ No newline at end of file
@app.route
(
'/deletar/<int:id>'
)
def
deletar
(
id
):
animal
=
Animal
.
query
.
get
(
id
)
db
.
session
.
delete
(
animal
)
db
.
session
.
commit
()
return
redirect
(
url_for
(
'index'
))
if
__name__
==
"__main__"
:
app
.
run
(
debug
=
True
)
\ No newline at end of file
Python/templates/login.html
0 → 100644
View file @
699db5da
<h2>
Login Fazenda
</h2>
<form
action=
"/catalogo"
>
<input
type=
"text"
placeholder=
"Usuário"
>
<button
type=
"submit"
>
Entrar no Catálogo
</button>
</form>
\ 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