diff options
author | BonfaceKilz | 2021-07-30 16:38:43 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-08-03 15:49:50 +0300 |
commit | 305a2fc37bc233c9842bb12346c7e476c1d81be7 (patch) | |
tree | 8ebacdb830330a87667f0ea597cbb4599afc5903 /wqflask | |
parent | 3804d64d6eed6c9b5fbb95758a84014ff026705d (diff) | |
download | genenetwork2-305a2fc37bc233c9842bb12346c7e476c1d81be7.tar.gz |
wqflask: views: Flash messages during edits
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/templates/edit_phenotype.html | 9 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/wqflask/wqflask/templates/edit_phenotype.html b/wqflask/wqflask/templates/edit_phenotype.html index 83daba58..0d7071f7 100644 --- a/wqflask/wqflask/templates/edit_phenotype.html +++ b/wqflask/wqflask/templates/edit_phenotype.html @@ -2,6 +2,15 @@ {% block title %}Trait Submission{% endblock %} {% block content %} <!-- Start of body --> +{% with messages = get_flashed_messages(with_categories=true) %} +{% if messages %} +{% for category, message in messages %} +<div class="container-fluid bg-{{ category }}"> + <p>{{ message }}</p> +</div> +{% endfor %} +{% endif %} +{% endwith %} <div class="page-header text-center"> <h1>Edit Trait for Published Database</h1> </div> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 0f1df123..18d3e99f 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -546,7 +546,7 @@ def update_phenotype(): data_ = request.form.to_dict() author = g.user_session.record.get(b'user_name') if 'file' not in request.files: - flash("No sample data has been uploaded") + flash("No sample-data has been uploaded", "warning") else: file_ = request.files['file'] trait_name = str(data_.get('dataset-name')) @@ -598,6 +598,7 @@ def update_phenotype(): dict_.update({"timestamp": datetime.datetime.now().strftime( "%Y-%m-%d %H:%M:%S")}) f.write(json.dumps(dict_)) + flash("Sample-data has been successfully uploaded", "success") # Run updates: phenotype_ = { "pre_pub_description": data_.get("pre-pub-desc"), @@ -649,6 +650,7 @@ def update_phenotype(): data=MetadataAudit(dataset_id=data_.get("dataset-name"), editor=author.decode("utf-8"), json_data=json.dumps(diff_data))) + flash(f"Diff-data: \n{diff_data}\nhas been uploaded", "success") return redirect(f"/trait/{data_.get('dataset-name')}" f"/edit/phenotype-id/{data_.get('phenotype-id')}") |