diff --git a/funders/models.py b/funders/models.py index 5ef9a4119c2a97da0fd36c758998004b93cf94e2..828d275f9751206067c9ac07bd80f9472f9d970b 100644 --- a/funders/models.py +++ b/funders/models.py @@ -1,5 +1,6 @@ from django.db import models from django.db.models import Q +from django.urls import reverse from journals.models import Publication @@ -22,6 +23,9 @@ class Funder(models.Model): result += ' (%s)' % self.acronym return result + def get_absolute_url(self): + return reverse('funders:funder_publications', args=(self.id,)) + def all_related_publications(self): return Publication.objects.filter( Q(funders_generic=self) | Q(grants__funder=self)).distinct() diff --git a/funders/templates/funders/funder_details.html b/funders/templates/funders/funder_details.html index cbb87326329e6355de796200919563e75fd01ed0..382cb69bb5ec80832975e65ba26e9bf61f000bd5 100644 --- a/funders/templates/funders/funder_details.html +++ b/funders/templates/funders/funder_details.html @@ -2,8 +2,6 @@ {% block pagetitle %}: Funder details{% endblock pagetitle %} -{% load bootstrap %} - {% block content %} <h1 class="highlight">Funder {{ funder.name }}</h1> diff --git a/funders/urls.py b/funders/urls.py index b424202a907b91320ab7dddbbb75d4e3d08a2376..6766a095b6aead907943bc6f501317e76d1ce5ff 100644 --- a/funders/urls.py +++ b/funders/urls.py @@ -6,8 +6,8 @@ urlpatterns = [ url(r'^$', views.funders, name='funders'), url(r'^query_crossref_for_funder$', views.query_crossref_for_funder, name='query_crossref_for_funder'), - url(r'^funders/add$', views.add_funder, name='add_funder'), - url(r'^funders/(?P<funder_id>[0-9]+)/$', views.funder_publications, + url(r'^add$', views.add_funder, name='add_funder'), + url(r'^(?P<funder_id>[0-9]+)/$', views.funder_publications, name='funder_publications'), url(r'^grants/add$', views.add_grant, name='add_grant'), ] diff --git a/funders/views.py b/funders/views.py index 1b3d3b8c20ab40e39a335be12f57d250615c24f6..b11b7a15baf0991b61bb864575f8d9e4a34a510f 100644 --- a/funders/views.py +++ b/funders/views.py @@ -53,10 +53,10 @@ def add_funder(request): return redirect(reverse('funders:funders')) -@permission_required('scipost.can_view_all_funding_info', raise_exception=True) +# @permission_required('scipost.can_view_all_funding_info', raise_exception=True) def funder_publications(request, funder_id): """ - See details of specific Funder. + See details of specific Funder (publicly accessible). """ funder = get_object_or_404(Funder, id=funder_id) context = {'funder': funder} diff --git a/journals/templates/journals/publication_detail.html b/journals/templates/journals/publication_detail.html index 911fcf398478aacdb3a9b4e189cb7b9d969bd0c6..a02fa03f8809361ed24f0dac7de156c36278cee4 100644 --- a/journals/templates/journals/publication_detail.html +++ b/journals/templates/journals/publication_detail.html @@ -97,12 +97,24 @@ {% if is_edcol_admin %} {# This function is not available for public yet! #} - <h3>Institutions related to this Publication: <small>(adminstrator only)</small></h3> - <ul> - {% for institution in publication.institutions.all %} - <li>{{ institution }}</li> - {% endfor %} - </ul> + <em>The following is not available for the public yet:</em> + {% if publication.funders_generic.exists %} + <h3>Funder{{ publication.funders_generic.count|pluralize }} for this publication:</h3> + <ul> + {% for funder in publication.funders_generic.all %} + <li><a href="{{ funder.get_absolute_url }}">{{ funder }}</a></li> + {% endfor %} + </ul> + {% endif %} + + {% if publication.institutions.exists %} + <h3>Institution{{ publication.institutions.count|pluralize }} related to this Publication:</h3> + <ul> + {% for institution in publication.institutions.all %} + <li>{{ institution }}</li> + {% endfor %} + </ul> + {% endif %} {% endif %} </div> </div>