瀏覽代碼

Adds admin_insert blueprint and removes unneeded code from admin_insert

Jose Reyes 6 年之前
父節點
當前提交
497337f51c
共有 2 個文件被更改,包括 4 次插入7 次删除
  1. 4
    0
      app/__init__.py
  2. 0
    7
      app/admin_insert.py

+ 4
- 0
app/__init__.py 查看文件

@@ -25,4 +25,8 @@ def create_app(test_config=None):
25 25
     app.register_blueprint(index.bp)
26 26
     app.add_url_rule('/', endpoint='index')
27 27
 
28
+    from . import admin_insert
29
+    app.register_blueprint(admin_insert.bp)
30
+    app.add_url_rule('/admin_insert', endpoint='admin_insert')
31
+
28 32
     return app

+ 0
- 7
app/admin_insert.py 查看文件

@@ -12,15 +12,8 @@ def admin():
12 12
     if request.method == 'POST':
13 13
         eName = request.form['eName']
14 14
         office = request.form['oficina']
15
-        last_turn = request.form['turno']
16 15
 
17 16
         db = get_db()
18
-        station_query_res = db.execute(
19
-            'SELECT s_id FROM station WHERE nombre_empleado=?',
20
-            (station_name,)
21
-        ).fetchone()
22
-        if station_query_res is not None:
23
-            station_id = station_query_res[0]
24 17
         db.execute(
25 18
             'INSERT INTO station (nombre_empleado, oficina, last_turn)'
26 19
             ' VALUES (?, ?, ?)',