diff options
-rw-r--r-- | wqflask/wqflask/templates/display_files.html | 3 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/wqflask/wqflask/templates/display_files.html b/wqflask/wqflask/templates/display_files.html index f8bc188f..4b4babc4 100644 --- a/wqflask/wqflask/templates/display_files.html +++ b/wqflask/wqflask/templates/display_files.html @@ -17,7 +17,8 @@ Show files for approval <ul> {% for file in files %} <li><a href="/display-file/{{ file }}" target="_blank">{{ file }}</a><br/> - <button><a href="/data-samples/approve/{{ file }}">Approve</a></button> <button>Reject</button></li> + <button><a href="/data-samples/approve/{{ file }}">Approve</a></button> + <button><a href="/data-samples/reject/{{ file }}">Reject</a></button></li> {% endfor %} </ul> </div> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 11c8b347..69b432f5 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -1446,6 +1446,15 @@ def approve_data(name): return redirect("/admin/data-sample/diffs/") +@app.route("/data-samples/reject/<name>") +def reject_data(name): + os.rename(os.path.join("/tmp/sample-data/diffs", name), + os.path.join("/tmp/sample-data/diffs", + f"{name}.rejected")) + flash(f"{name} has been rejected!", "success") + return redirect("/admin/data-sample/diffs/") + + @app.route("/display-file/<name>") def display_file(name): with open(os.path.join("/tmp/sample-data/diffs", name), 'r') as myfile: |