SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 46f3e8c0 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Improve publication detail page wrt organizations

parent 7f2581b7
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS
from scipost.fields import ChoiceArrayField
################
# Journals etc #
################
......@@ -492,6 +493,14 @@ class Publication(models.Model):
return val
raise KeyError
def get_all_affiliations(self):
"""
Returns all author affiliations.
"""
from organizations.models import Organization
return Organization.objects.filter(
publicationauthorstable__publication=self).distinct()
def get_all_funders(self):
from funders.models import Funder
return Funder.objects.filter(
......
......@@ -96,7 +96,7 @@
<div class="row">
<div class="col-12">
<h3>Authors</h3>
<h3>Author{{ publication.authors.all|length|pluralize }}</h3>
<ul>
{% for author in publication.authors.all %}
{% if author.is_registered %}
......@@ -107,8 +107,15 @@
{% endfor %}
</ul>
<h3>Affiliation{{ publication.get_all_affiliations|length|pluralize }}</h3>
<ul>
{% for aff in publication.get_all_affiliations %}
<li><a href="{{ aff.get_absolute_url }}">{{ aff.name_full }}</a></li>
{% endfor %}
</ul>
{% if publication.get_all_funders %}
<h3>Funder{{ publication.get_all_funders|length|pluralize }} for this publication</h3>
<h3>Funder{{ publication.get_all_funders|length|pluralize }} for the research work leading to this publication</h3>
<ul>
{% for funder in publication.get_all_funders %}
<li><a href="{{ funder.get_absolute_url }}">{{ funder }}</a></li>
......@@ -116,14 +123,16 @@
</ul>
{% endif %}
{% if is_scipost_admin or is_edcol_admin %}
{% if publication.institutions.all %}
<h3>Institution{{ publication.institutions.all|pluralize }} related to this Publication</h3>
<h3>Institution{{ publication.institutions.all|pluralize }} related to this Publication (<span class="text-danger">Admin-only view, to be removed</span>)</h3>
<ul>
{% for institution in publication.institutions.all %}
<li><a href="{{ institution.get_absolute_url }}">{{ institution }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
......
......@@ -13,7 +13,7 @@ from django_countries.fields import CountryField
from .constants import ORGANIZATION_TYPES, ORGANIZATION_STATUSES, ORGSTATUS_ACTIVE
from scipost.models import Contributor
from journals.models import Publication, PublicationAuthorsTable, OrgPubFraction, UnregisteredAuthor
from journals.models import Publication, OrgPubFraction, UnregisteredAuthor
class Organization(models.Model):
"""
......@@ -66,6 +66,20 @@ class Organization(models.Model):
def __str__(self):
return self.name
def name_and_acronym(self):
if self.acronym:
return '%s (%s)' % (self.name, self.acronym)
return self.name
def name_full(self):
text = ''
if self.name_original:
text += self.name_original + ' / '
text += self.name
if self.acronym:
text += ' (' + self.acronym + ')'
return text
@property
def full_name(self):
full_name_str = ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment