Beispiel #1
0
def fridges_delete():
    database = Database(filename)
    user_id = session['user_id']
    #user_id = 1
    material = request.args['name']
    #print 'calling deleteFromFridge({},{})'.format(user_id, [material])
    database.deleteFromFridge(user_id, [material])
    return redirect(url_for('fridges'))
Beispiel #2
0
def admin_fridges_delete():
    if not 'user_id' in session:
        return redirect(url_for('login_name'))
    if session['user_id'] != 0:
        return "You don't have the access!"
    user_id = request.args['current_user_id']
    database = Database(filename)
    #user_id = 1
    material = request.args['name']
    #print 'calling deleteFromFridge({},{})'.format(user_id, [material])
    database.deleteFromFridge(user_id, [material])
    return redirect(url_for('admin_fridges', user_id=user_id))