SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 5a688e81 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix funders

parent 8da4b54d
No related branches found
No related tags found
No related merge requests found
...@@ -463,6 +463,11 @@ class Publication(models.Model): ...@@ -463,6 +463,11 @@ class Publication(models.Model):
return val return val
raise KeyError raise KeyError
def get_all_funders(self):
from funders.models import Funder
return Funder.objects.filter(
models.Q(grants__publications=self) | models.Q(publications=self)).distinct()
@property @property
def doi_string(self): def doi_string(self):
return '10.21468/' + self.doi_label return '10.21468/' + self.doi_label
......
...@@ -107,10 +107,10 @@ ...@@ -107,10 +107,10 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% if publication.funders_generic.all %} {% if publication.get_all_funders %}
<h3>Funder{{ publication.funders_generic.count|pluralize }} for this publication</h3> <h3>Funder{{ publication.get_all_funders|length|pluralize }} for this publication</h3>
<ul> <ul>
{% for funder in publication.funders_generic.all %} {% for funder in publication.get_all_funders %}
<li><a href="{{ funder.get_absolute_url }}">{{ funder }}</a></li> <li><a href="{{ funder.get_absolute_url }}">{{ funder }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
......
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