aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-08-02 21:57:41 +0300
committerBonfaceKilz2021-08-03 15:49:50 +0300
commit3241306917277278a218270a6691d103df6fee4e (patch)
treedeefd9df3a12e5c6557a448d6a38833dfd380f26
parent366c9c433a0b18db25f5cb28d7c7dc1ed17b3c67 (diff)
downloadgenenetwork2-3241306917277278a218270a6691d103df6fee4e.tar.gz
Reject diff data on click
-rw-r--r--wqflask/wqflask/templates/display_files.html3
-rw-r--r--wqflask/wqflask/views.py9
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: