diff --git a/servicePoints/templates/viewRequests.html b/servicePoints/templates/viewRequests.html index 0fdfe3e8d00a6288b1d7e58450bdb0e311801c7a..dc456024e8885b430f49cd9131e8372860809766 100644 --- a/servicePoints/templates/viewRequests.html +++ b/servicePoints/templates/viewRequests.html @@ -20,12 +20,14 @@ <form action="/accounts/viewRequests/" method="post" enctype="multipart/form-data"> <input type="hidden" name="postid" value="{{request.postid}}"/> <input type="hidden" name="user" value="{{request.member}}"/> + <input type="hidden" name="filename" value="{{request.filename}}"/> <input type="text" name="numHours" /> <input type="submit" name="confirm" value="confirm"/> </form> Please give an explanation as to why you're denying this request: <form action="/accounts/viewRequests/" method="post" enctype="multipart/form-data"> <input type="hidden" name="postid" value="{{request.postid}}"/> + <input type="hidden" name="filename" value="{{request.filename}}"/> <input type="text" name="reason" /> <input type="submit" name = "deny" value="deny" /> </form> diff --git a/servicePoints/views/__pycache__/accounts.cpython-36.pyc b/servicePoints/views/__pycache__/accounts.cpython-36.pyc index 4ba19d6efd3e3db5738035f1388328b73a649cd8..395b717c44002cd785339b56c3476f82f7ed0503 100644 Binary files a/servicePoints/views/__pycache__/accounts.cpython-36.pyc and b/servicePoints/views/__pycache__/accounts.cpython-36.pyc differ diff --git a/servicePoints/views/__pycache__/accounts.cpython-36.pyc.140159331448656 b/servicePoints/views/__pycache__/accounts.cpython-36.pyc.140159331448656 new file mode 100644 index 0000000000000000000000000000000000000000..a6f84b6ca5da4b2483f1af58173ee631920a874a Binary files /dev/null and b/servicePoints/views/__pycache__/accounts.cpython-36.pyc.140159331448656 differ diff --git a/servicePoints/views/accounts.py b/servicePoints/views/accounts.py index 2a04d0057658257f1b56485a9a1275a6744a812a..25843ff34a97bf74dfe341428f5e3d2268b8c0e0 100644 --- a/servicePoints/views/accounts.py +++ b/servicePoints/views/accounts.py @@ -185,8 +185,11 @@ def viewRequests(): if flask.request.method == 'POST': if 'deny' in flask.request.form: post = flask.request.form["postid"] + file = flask.request.form["filename"] servicePoints.model.get_db().execute('DELETE FROM requests WHERE postid =:one ', {"one": post}) + os.remove(os.path.join( + servicePoints.app.config["IMAGES_FOLDER"], file)) if 'confirm' in flask.request.form: try: numHours = int(flask.request.form["numHours"]) @@ -194,6 +197,7 @@ def viewRequests(): return flask.redirect(flask.url_for('hourError')) post = flask.request.form["postid"] user = flask.request.form["user"] + file = flask.request.form["filename"] hours = servicePoints.model.get_db().execute('SELECT hours FROM users WHERE username =:one ', {"one": user}) dbHours = hours.fetchone() @@ -202,6 +206,8 @@ def viewRequests(): {"one": dbHours["hours"], "two": user}) servicePoints.model.get_db().execute('DELETE FROM requests WHERE postid =:one ', {"one": post}) + os.remove(os.path.join( + servicePoints.app.config["IMAGES_FOLDER"], file)) username = flask.session["username"] cursor = servicePoints.model.get_db() diff --git a/var/servicePoints.sqlite3 b/var/servicePoints.sqlite3 index c9688391db04fec06d56cf9e7b36fb102a328af5..9599fb8a735dd76dc6574171b10ce6a4cf28966f 100644 Binary files a/var/servicePoints.sqlite3 and b/var/servicePoints.sqlite3 differ