Появление сущности накладной + перенос waybill.css в отдельную папку

This commit is contained in:
2024-12-01 20:16:56 +03:00
parent 988d8fe006
commit b3f856b401
6 changed files with 36 additions and 38 deletions

View File

@@ -1,16 +1,24 @@
from flask import request, Blueprint, render_template, session, current_app, redirect, url_for
from checker import check_auth
from .model import waybill_model
waybill_bp = Blueprint('waybill_bp', __name__, template_folder='templates')
from .model import workpiece_list, clear
waybill_bp = Blueprint('waybill_bp', __name__, template_folder='templates', static_folder='static')
@waybill_bp.route('/', methods=['GET', 'POST'])
@waybill_bp.route('/', methods=['GET'])
@check_auth
def index():
lst = workpiece_list()
if lst.status:
return render_template('waybill.html', items=lst.result)
else:
return render_template('error.html', error_message=lst.error_message)
@waybill_bp.route('/clear', methods=['GET'])
@check_auth
def clear_basket():
clear()
return redirect(url_for('waybill_bp.index'))
@waybill_bp.route('/', methods=['POST'])
def waybill():
if request.method == 'GET':
pack = waybill_model()
if pack.status:
return render_template('waybill.html', items=pack.result)
else:
return render_template('error.html', error_message=pack.error_message)
print(request.form)
return 'OK'