示例#1
0
def ship_delete(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    ship = Ship.query.get(rec_id)
    if not ship:
        abort(404)
    success, msg = delete_records(ship)
    flash(msg)
    return redirect(url_for('ship_view'))
示例#2
0
def engine_delete(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    engine = Engine.query.get(rec_id)
    if not engine:
        abort(404)
    success, msg = delete_records(engine)
    flash(msg)
    return redirect(url_for('engine_view'))
示例#3
0
def builder_delete(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    builder = Builder.query.get(rec_id)
    if not builder:
        abort(404)
    success, msg = delete_records(builder)
    flash(msg)
    return redirect(url_for('builder_view'))
示例#4
0
def users_delete(rec_id: int = None):
    if current_user.is_authenticated and current_user.is_admin:
        user = User.query.get(rec_id)
        if not user:
            return
        success, msg = delete_records(user)
        flash(msg)
        return redirect(url_for('users_view'))
    else:
        return abort(403)