1234567891011121314151617181920212223242526272829303132 |
- from flask import (
- Blueprint, flash, g, redirect, render_template, request, url_for
- )
- from werkzeug.exceptions import abort
-
- from app.db import get_db
-
- bp = Blueprint('admin', __name__)
-
- @bp.route('/admin', methods=('GET', 'POST'))
- def admin():
- if request.method == 'POST':
- eName = request.form['eName']
- office = request.form['oficina']
- last_turn = request.form['turno']
-
- db = get_db()
- station_query_res = db.execute(
- 'SELECT s_id FROM station WHERE nombre_empleado=?',
- (station_name,)
- ).fetchone()
- if station_query_res is not None:
- station_id = station_query_res[0]
- db.execute(
- 'INSERT INTO station (nombre_empleado, oficina, last_turn, timeArrival, station)'
- ' VALUES (?, ?, ?, ?, ?)',
- (eName, office, turn, 0)
- )
- db.commit()
- return redirect(url_for('admin'))
-
- return render_template('admin.html')
|