diff --git a/ontology/templates/ontology/_topic_card.html b/ontology/templates/ontology/_topic_card.html index 977868b955bddc8127f56f52b9c2c0e95e34bf48..b10236689f59557e121bf5d81f1863d3da4ce9be 100644 --- a/ontology/templates/ontology/_topic_card.html +++ b/ontology/templates/ontology/_topic_card.html @@ -126,9 +126,9 @@ {% get_profiles topic.slug as profiles %} {% for profile in profiles %} {% if profile.contributor %} - <li><a href="{{ profile.contributor.get_absolute_url }}">{{ profile }}</a></li> + <li><a href="{{ profile.contributor.get_absolute_url }}">{{ profile }}</a> ({{ profile.count }})</li> {% else %} - <li>{{ profile }}</li> + <li>{{ profile }} ({{ profile.count }})</li> {% endif %} {% empty %} <li>No Profile found</li> diff --git a/profiles/models.py b/profiles/models.py index ae6ae3ffa8bf2ab3f5e983daf13304608e683d12..711eeb20d88b37eeb95e00dbb672506298db890f 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -140,7 +140,8 @@ def get_profiles(slug): unreg_id_list = [tbl.unregistered_author.id for tbl in publications.all() \ if tbl.unregistered_author is not None] return Profile.objects.filter(models.Q(contributor__id__in=cont_id_list) | - models.Q(unregisteredauthor__id__in=unreg_id_list)) + models.Q(unregisteredauthor__id__in=unreg_id_list + )).annotate(count=models.Count('id')).distinct().order_by('-count') class ProfileNonDuplicates(models.Model):