diff --git a/website/involvement/wagtail_hooks.py b/website/involvement/wagtail_hooks.py index 55acd404..4d79a375 100644 --- a/website/involvement/wagtail_hooks.py +++ b/website/involvement/wagtail_hooks.py @@ -13,7 +13,7 @@ from involvement.models import Team, Role, Position, Application, \ official_of, member_of -from involvement.rules import is_admin +from involvement.rules import is_admin, approve_state, appoint_state from utils.permissions import RulesPermissionHelper @@ -157,13 +157,15 @@ def get_buttons_for_obj(self, obj, exclude=None, classnames_add=None, ph = self.permission_helper usr = self.request.user pk = quote(getattr(obj, self.opts.pk.attname)) - if 'approve' not in exclude and ph.user_can_approve_obj(usr, obj): + if 'approve' not in exclude and approve_state(usr, obj)\ + and ph.user_can_approve_obj(usr, obj): btns.append( self.approve_button( pk, classnames_add, classnames_exclude ) ) - if 'appoint' not in exclude and ph.user_can_appoint_obj(usr, obj): + if 'appoint' not in exclude and appoint_state(usr, obj)\ + and ph.user_can_appoint_obj(usr, obj): btns.append( self.appoint_button( pk, classnames_add, classnames_exclude