24 lines
768 B
Python
24 lines
768 B
Python
from flask import request, Blueprint, render_template, session, current_app, redirect, url_for
|
|
from checker import check_auth
|
|
from .model import workpiece_list, clear
|
|
waybill_bp = Blueprint('waybill_bp', __name__, template_folder='templates', static_folder='static')
|
|
|
|
@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_waybill():
|
|
clear()
|
|
return redirect(url_for('waybill_bp.index'))
|
|
|
|
@waybill_bp.route('/', methods=['POST'])
|
|
def waybill():
|
|
print(request.form)
|
|
return 'OK' |