Skip to content

Commit

Permalink
Merge pull request #368 from ens-lgil/feature/new_browse_scores_page_2
Browse files Browse the repository at this point in the history
Fix Publication table display (mainly the header) in the 'Latest rele…
  • Loading branch information
fyvon authored May 22, 2024
2 parents d42d189 + 641e42d commit c39c482
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions catalog/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<br/>Publication/Study<br/>ID <span>(PGP)</span>'))
scores_count = tables.Column(accessor='scores_count', verbose_name=format_html('PGS<br/>Developed'), orderable=False)
scores_evaluated = tables.Column(accessor='scores_evaluated_count', verbose_name=format_html('PGS<br/>Evaluated'), orderable=False)
doi = tables.Column(accessor='doi', verbose_name=format_html('Digital object identifier <span>(doi)</span>'))
PMID = tables.Column(accessor='PMID', verbose_name=format_html('PubMed ID<br/><span>(PMID)</span>'))
date_publication = tables.Column(accessor='date_publication', verbose_name=format_html('Publication<br/>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 <span>(ontology term label)</span>'), orderable=True)
Expand Down
2 changes: 1 addition & 1 deletion catalog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down

0 comments on commit c39c482

Please sign in to comment.