diff --git a/communities/models.py b/communities/models.py
index c42c8494..08a77587 100644
--- a/communities/models.py
+++ b/communities/models.py
@@ -4,6 +4,7 @@
from django_countries.fields import CountryField
from institutions.models import Institution
import uuid
+from itertools import chain
import os
class ApprovedManager(models.Manager):
@@ -74,6 +75,11 @@ def get_collaborator(self):
def __str__(self):
return str(self.community_name)
+ @property
+ def approved_label(self):
+ approved_label = (self.tklabel_community.filter(is_approved=True).first() or self.bclabel_community.filter(is_approved=True).first())
+ return approved_label
+
class Meta:
indexes = [models.Index(fields=['id', 'community_creator', 'image'])]
verbose_name = 'Community'
diff --git a/institutions/models.py b/institutions/models.py
index dbe3511a..d8aa3013 100644
--- a/institutions/models.py
+++ b/institutions/models.py
@@ -78,6 +78,11 @@ def get_distinct_creators(self):
def __str__(self):
return str(self.institution_name)
+ @property
+ def institution_projects(self):
+ institution_projects = self.institution_created_project.filter(institution=self)
+ return institution_projects
+
class Meta:
indexes = [models.Index(fields=['id', 'institution_creator', 'image'])]
verbose_name = 'Institution'
diff --git a/templates/accounts/dashboard.html b/templates/accounts/dashboard.html
index d33552d7..cc9bbd0d 100644
--- a/templates/accounts/dashboard.html
+++ b/templates/accounts/dashboard.html
@@ -28,13 +28,13 @@
{% if user_communities %}
{% for community in user_communities %}
- {% include 'partials/infocards/_community-card.html' %}
+ {% include 'partials/infocards/_community-card.html' with approved_label=community.approved_label %}
{% endfor %}
{% endif %}
{% if user_institutions %}
{% for institution in user_institutions %}
- {% include 'partials/infocards/_institution-card.html' %}
+ {% include 'partials/infocards/_institution-card.html' with institution_projects=institution.institution_projects %}
{% endfor %}
{% endif %}
diff --git a/templates/partials/infocards/_community-card.html b/templates/partials/infocards/_community-card.html
index 4a643bc0..f52d52ff 100644
--- a/templates/partials/infocards/_community-card.html
+++ b/templates/partials/infocards/_community-card.html
@@ -32,10 +32,6 @@
{% endif %}
{% if '/dashboard/' in request.path %}
- View account
{% if approved_label %}
{% if request.user in community.get_collaborator or request.user == community.community_creator %}
View account
diff --git a/templates/partials/infocards/_institution-card.html b/templates/partials/infocards/_institution-card.html
index fd8bb0c9..0895aae8 100644
--- a/templates/partials/infocards/_institution-card.html
+++ b/templates/partials/infocards/_institution-card.html
@@ -41,7 +41,6 @@
{% endif %}
{% if '/dashboard/' in request.path %}
-