passei os frontends pra bootstrap-flask
This commit is contained in:
14
app.py
14
app.py
@@ -18,11 +18,13 @@ from functions.database import (
|
||||
from sqlalchemy import create_engine, and_
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from datetime import datetime
|
||||
from flask_bootstrap import Bootstrap5
|
||||
|
||||
Session = sessionmaker(bind=engine)
|
||||
session = Session()
|
||||
|
||||
app = Flask(__name__)
|
||||
bootstrap = Bootstrap5(app)
|
||||
|
||||
|
||||
def session_run(model):
|
||||
@@ -236,19 +238,11 @@ def listar_relatorios_vendas():
|
||||
def home():
|
||||
links = []
|
||||
for rule in app.url_map.iter_rules():
|
||||
# Filter out rules we can't navigate to in a browser
|
||||
# and rules that require parameters
|
||||
if "GET" in rule.methods and has_no_empty_params(rule):
|
||||
url = url_for(rule.endpoint, **(rule.defaults or {}))
|
||||
links.append((url, rule.endpoint))
|
||||
l_html = ""
|
||||
for l in links:
|
||||
l_html += f'<a href="{l[0]}">{l[1].replace("_"," ")}</a><br>'
|
||||
home_html = f"""
|
||||
<p>Links</p>
|
||||
{l_html}
|
||||
"""
|
||||
return home_html
|
||||
|
||||
return render_template('home.html', links=links)
|
||||
|
||||
|
||||
def has_no_empty_params(rule):
|
||||
|
||||
Reference in New Issue
Block a user