diff options
author | BonfaceKilz | 2021-05-20 23:22:49 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-05-26 20:01:28 +0300 |
commit | 2de0bdc7c3350dacf14218bb1a1e4721ac4d1237 (patch) | |
tree | 20c6e43415818ae58395b0f723507207f090553b /wqflask | |
parent | 41408d44d23dc93afc85f8428fa2f6944fc902bb (diff) | |
download | genenetwork2-2de0bdc7c3350dacf14218bb1a1e4721ac4d1237.tar.gz |
wqflask: views: Add extra endpoint to display individual trait edit
* wqflask/wqflask/views.py (show_edit_trait_page): New function/
end-point.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/views.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 4834ee63..51266ada 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -21,6 +21,7 @@ import base64 import array import sqlalchemy from wqflask import app +from flask import current_app from flask import g from flask import Response from flask import request @@ -414,13 +415,35 @@ def submit_trait_form(): version=GN_VERSION) -@app.route("/edit_trait_form") -def edit_trait_page(): - species_and_groups = get_species_groups() +@app.route("/trait/<name>/edit/<inbred_set_id>") +def show_edit_trait_page(name, inbred_set_id): + from gn3.db.phenotypes import (Phenotype, + PublishXRef, + Publication, + fetchone) + import MySQLdb + conn = MySQLdb.Connect(db=current_app.config.get("DB_NAME"), + user=current_app.config.get("DB_USER"), + passwd=current_app.config.get("DB_PASS"), + host=current_app.config.get("DB_HOST")) + publish_xref = fetchone( + conn=conn, + table="PublishXRef", + where=PublishXRef(id_=name, + inbred_set_id=inbred_set_id)) + phenotype_ = fetchone( + conn=conn, + table="Phenotype", + where=Phenotype(id_=publish_xref.phenotype_id)) + publication_ = fetchone( + conn=conn, + table="Publication", + where=Publication(id_=publish_xref.publication_id)) return render_template( "edit_trait.html", - species_and_groups=species_and_groups, - gn_server_url=GN_SERVER_URL, + publish_xref=publish_xref, + phenotype=phenotype_, + publication=publication_, version=GN_VERSION) |