Доп оформление запросов

This commit is contained in:
Anton Kamalov
2024-10-24 11:03:19 +03:00
parent bd45f9c068
commit f2730d85d4
2 changed files with 7 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ from .requests_route import route
import json import json
with open(path.join(path.dirname(__file__), 'zapros_menu.json')) as f: with open(path.join(path.dirname(__file__), 'zapros_menu.json')) as f:
options = json.load(f) requests_list = json.load(f)
sql_provider = SQLProvider(path.join(path.dirname(__file__), 'sql')) sql_provider = SQLProvider(path.join(path.dirname(__file__), 'sql'))
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates') requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
@@ -15,7 +15,7 @@ requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
@check_auth @check_auth
def requests(): def requests():
if request.method == 'GET': if request.method == 'GET':
return render_template('zapros_menu.html', options=options) return render_template('zapros_menu.html', options=requests_list)
else: else:
return 'error' return 'error'
@@ -33,6 +33,6 @@ def sklad_zapros():
zagotovki = route(session['db_config'], material, sql_provider, 'zapros1.sql') zagotovki = route(session['db_config'], material, sql_provider, 'zapros1.sql')
if zagotovki.status: if zagotovki.status:
categories = ['Материал', 'Вес', 'Цена', 'Количество'] categories = ['Материал', 'Вес', 'Цена', 'Количество']
return render_template('output.html', items=zagotovki.result, categories = categories) return render_template('output.html', items=zagotovki.result, titles = categories, object='Заготовки на складе')
else: else:
return zagotovki.error_message return zagotovki.error_message

View File

@@ -2,19 +2,19 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Заготовки на складе</title> <title>{{ object }}</title>
<link href="/static/css/main.css" type="text/css" rel="stylesheet"> <link href="/static/css/main.css" type="text/css" rel="stylesheet">
</head> </head>
<body> <body>
<div class="logout"> <div class="logout">
<a href="{{ url_for('logout') }}"><button>Выход</button></a> <a href="{{ url_for('logout') }}"><button>Выход</button></a>
</div> </div>
<h1>Заготовки на складе</h1> <h1>{{ object }}</h1>
<!-- Output --> <!-- Output -->
<table> <table>
<tr> <tr>
{% for category in categories %} {% for title in titles %}
<th>{{ category }}</th> <th>{{ title }}</th>
{% endfor %} {% endfor %}
</tr> </tr>
{% for item in items %} {% for item in items %}