123456789101112131415161718192021222324252627 |
- from flask import (
- Blueprint, flash, g, redirect, render_template, request, url_for
- )
- from werkzeug.exceptions import abort
-
- from app.db import get_db
- from app.forms import StationForm
-
- bp = Blueprint('admin_remove', __name__)
-
- @bp.route('/admin_remove', methods=('GET', 'POST'))
- def admin_remove():
- form = StationForm()
- if form.validate_on_submit():
- valueToDelete = request.form['value']
- delete_id=request.form['what_to_delete']
- db = get_db()
- db.execute(
- 'DELETE FROM station WHERE'+delete_id+' = ?', (valueToDelete,)
- )
- db.commit()
-
- flash('Removed station for ' + delete_id +' with value '+ valueToDelete)
-
- return redirect(url_for('admin_remove'))
-
- return render_template('admin_remove.html', form=form)
|