diff --git a/judge/views/organization.py b/judge/views/organization.py index d36e7ab..411074d 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -109,6 +109,13 @@ class OrganizationBase(object): self.request.profile in org if self.request.user.is_authenticated else False ) + def is_admin(self, org=None): + if org is None: + org = self.object + if self.request.profile: + return org.admins.filter(id=self.request.profile.id).exists() + return False + def can_access(self, org): if self.request.user.is_superuser: return True @@ -121,6 +128,7 @@ class OrganizationMixin(OrganizationBase): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["is_member"] = self.is_member(self.organization) + context["is_admin"] = self.is_admin(self.organization) context["can_edit"] = self.can_edit_organization(self.organization) context["organization"] = self.organization context["logo_override_image"] = self.organization.logo_override_image diff --git a/templates/organization/org-right-sidebar.html b/templates/organization/org-right-sidebar.html index 0a60aca..b1f5920 100644 --- a/templates/organization/org-right-sidebar.html +++ b/templates/organization/org-right-sidebar.html @@ -56,7 +56,7 @@ {% endif %} - {% if is_member and not can_edit %} + {% if is_member and not is_admin %}