diff --git a/catalog/tables.py b/catalog/tables.py index 12e60d06..c0672cd7 100644 --- a/catalog/tables.py +++ b/catalog/tables.py @@ -350,6 +350,35 @@ class Meta: template_name = 'catalog/pgs_catalog_django_table.html' +class PublicationTable(tables.Table): + id = tables.Column(accessor='id', verbose_name=format_html('PGS
Publication/Study
ID (PGP)')) + scores_count = tables.Column(accessor='scores_count', verbose_name=format_html('PGS
Developed'), orderable=False) + scores_evaluated = tables.Column(accessor='scores_evaluated_count', verbose_name=format_html('PGS
Evaluated'), orderable=False) + doi = tables.Column(accessor='doi', verbose_name=format_html('Digital object identifier (doi)')) + PMID = tables.Column(accessor='PMID', verbose_name=format_html('PubMed ID
(PMID)')) + date_publication = tables.Column(accessor='date_publication', verbose_name=format_html('Publication
Date')) + class Meta: + model = Publication + attrs = { + "data-show-columns" : "true", + "data-sort-name" : "id", + "data-page-size" : page_size, + "data-export-options" : '{"fileName": "pgs_latest_publications_data"}' + } + fields = [ + 'id', + 'scores_count', + 'scores_evaluated', + 'firstauthor', + 'title', + 'journal', + 'date_publication', + 'doi', + 'PMID' + ] + template_name = 'catalog/pgs_catalog_django_table.html' + + class Browse_TraitTable(tables.Table): '''Table to browse Traits in the PGS Catalog''' label_link = Column_format_html(accessor='display_label', verbose_name=format_html('Trait (ontology term label)'), orderable=True) diff --git a/catalog/views.py b/catalog/views.py index 91432991..85c4d437 100644 --- a/catalog/views.py +++ b/catalog/views.py @@ -477,7 +477,7 @@ def latest_release(request): publication_defer = ['authors','curation_status','curation_notes'] publication_prefetch_related = [pgs_prefetch['publication_score'], pgs_prefetch['publication_performance']] publications = Publication.objects.defer(*publication_defer).filter(date_released=release_date).prefetch_related(*publication_prefetch_related) - publications_table = Browse_PublicationTable(publications, order_by="num") + publications_table = PublicationTable(publications, order_by="num") context['publications_table'] = publications_table context['publications_count'] = latest_release['publication_count']