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
3
Issues
3
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
O Bar da Lora
CRUD Animais da Fazenda
Commits
984d3474
Commit
984d3474
authored
Apr 16, 2026
by
Mariana Bongiolo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of
http://gitlab.ariquemes.ifro.edu.br/grupo/CRUD
parents
46a22757
1a7fa3cf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
9 deletions
+18
-9
app.py
app/app.py
+10
-5
relatorio.md
relatorio.md
+5
-1
cadastrar.html
templates/cadastrar.html
+2
-2
index.html
templates/index.html
+1
-1
No files found.
app
.py
/app.py
→
app/app.py
View file @
984d3474
...
@@ -2,10 +2,15 @@ from flask import Flask, render_template, request, redirect, url_for
...
@@ -2,10 +2,15 @@ from flask import Flask, render_template, request, redirect, url_for
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_sqlalchemy
import
SQLAlchemy
import
os
import
os
app
=
Flask
(
__name__
)
ROOT_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
))
app
=
Flask
(
__name__
,
template_folder
=
os
.
path
.
join
(
ROOT_DIR
,
'templates'
),
static_folder
=
os
.
path
.
join
(
ROOT_DIR
,
'static'
)
)
# Caminho do banco
# Caminho do banco
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
basedir
=
ROOT_DIR
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
'sqlite:///'
+
os
.
path
.
join
(
basedir
,
'animais.db'
)
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
'sqlite:///'
+
os
.
path
.
join
(
basedir
,
'animais.db'
)
app
.
config
[
'SQLALCHEMY_TRACK_MODIFICATIONS'
]
=
False
app
.
config
[
'SQLALCHEMY_TRACK_MODIFICATIONS'
]
=
False
...
@@ -56,8 +61,8 @@ def index():
...
@@ -56,8 +61,8 @@ def index():
animais
=
Animal
.
query
.
all
()
animais
=
Animal
.
query
.
all
()
return
render_template
(
'index.html'
,
animais
=
animais
)
return
render_template
(
'index.html'
,
animais
=
animais
)
@app.route
(
'/cadastr
o
'
,
methods
=
[
'GET'
,
'POST'
])
@app.route
(
'/cadastr
ar
'
,
methods
=
[
'GET'
,
'POST'
])
def
cadastr
o
():
def
cadastr
ar
():
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
try
:
try
:
novo
=
Animal
(
novo
=
Animal
(
...
@@ -78,7 +83,7 @@ def cadastro():
...
@@ -78,7 +83,7 @@ def cadastro():
db
.
session
.
rollback
()
db
.
session
.
rollback
()
return
f
"Erro ao cadastrar: {str(e)}"
return
f
"Erro ao cadastrar: {str(e)}"
return
render_template
(
'cadastr
o
.html'
)
return
render_template
(
'cadastr
ar
.html'
)
@app.route
(
'/delete/<int:id>'
)
@app.route
(
'/delete/<int:id>'
)
def
delete
(
id
):
def
delete
(
id
):
...
...
relatorio.md
View file @
984d3474
# Relatório de Animais
# Relatório de Animais
Nenhum animal cadastrado.
## Marcos
-
Espécie: Pitcher
-
Idade: 17 anos
-
Peso: 67.0 kg
templates/cadastrar.html
View file @
984d3474
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename='st
atic/st
yle.css') }}"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename='style.css') }}"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
href=
"https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
rel=
"stylesheet"
>
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
Nome:
<input
type=
"text"
name=
"nome"
required
><br>
Nome:
<input
type=
"text"
name=
"nome"
required
><br>
Especie:
<input
type=
"text"
name=
"especie"
required
><br>
Especie:
<input
type=
"text"
name=
"especie"
required
><br>
Idade:
<input
type=
"number"
name=
"idade"
required
><br>
Idade:
<input
type=
"number"
name=
"idade"
required
><br>
Peso:
<input
type=
"number"
name=
"cidade
"
required
><br>
Peso:
<input
type=
"number"
step=
"any"
name=
"peso
"
required
><br>
<button
type=
"submit"
>
Salvar
</button>
<button
type=
"submit"
>
Salvar
</button>
</form>
</form>
</body>
</body>
...
...
templates/index.html
View file @
984d3474
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename='st
atic/st
yle.css') }}"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename='style.css') }}"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
href=
"https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
rel=
"stylesheet"
>
...
...
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