diff options
-rw-r--r-- | uploader/phenotypes/views.py | 11 | ||||
-rw-r--r-- | uploader/templates/phenotypes/view-phenotype.html | 13 |
2 files changed, 23 insertions, 1 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 9c5c71a..8ecd305 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -44,7 +44,8 @@ from .models import (dataset_by_id, phenotypes_count, save_new_dataset, dataset_phenotypes, - datasets_by_population) + datasets_by_population, + phenotype_publication_data) phenotypesbp = Blueprint("phenotypes", __name__) render_template = make_template_renderer("phenotypes") @@ -232,6 +233,14 @@ def view_phenotype(# pylint: disable=[unused-argument] dataset=dataset, phenotype=phenotype, has_se=all(bool(item.get("error")) for item in phenotype["data"]), + publish_data={ + key.replace("_", " "): val + for key,val in + (phenotype_publication_data(conn, phenotype["Id"]) or {}).items() + if (key in ("PubMed_ID", "Authors", "Title", "Journal") + and val is not None + and val.strip() is not "") + }, privileges=(privileges ### For demo! Do not commit this part + ("group:resource:edit-resource", diff --git a/uploader/templates/phenotypes/view-phenotype.html b/uploader/templates/phenotypes/view-phenotype.html index 5ed45b7..03f7ea0 100644 --- a/uploader/templates/phenotypes/view-phenotype.html +++ b/uploader/templates/phenotypes/view-phenotype.html @@ -45,6 +45,19 @@ <td><strong>Units</strong></td> <td>{{phenotype.Units}}</td> </tr> + {%for key,value in publish_data.items()%} + <tr> + <td><strong>{{key}}</strong></td> + <td>{{value}}</td> + </tr> + {%else%} + <tr> + <td colspan="2" class="text-muted"> + <span class="glyphicon glyphicon-exclamation-sign"></span> + No publication data found. + </td> + </tr> + {%endfor%} </tbody> </table> |