From f36a5497e022576b85f9536fec6d95e4060d0a5a Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sat, 24 Sep 2022 23:50:26 -0500 Subject: [PATCH] Fix error when access deleted org --- judge/views/organization.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/judge/views/organization.py b/judge/views/organization.py index c251bc5..0414516 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -157,7 +157,9 @@ class OrganizationMixin(OrganizationBase): class AdminOrganizationMixin(OrganizationMixin): def dispatch(self, request, *args, **kwargs): res = super(AdminOrganizationMixin, self).dispatch(request, *args, **kwargs) - if self.can_edit_organization(self.organization): + if not hasattr(self, "organization") or self.can_edit_organization( + self.organization + ): return res return generic_message( request, @@ -170,7 +172,7 @@ class AdminOrganizationMixin(OrganizationMixin): class MemberOrganizationMixin(OrganizationMixin): def dispatch(self, request, *args, **kwargs): res = super(MemberOrganizationMixin, self).dispatch(request, *args, **kwargs) - if self.can_access(self.organization): + if not hasattr(self, "organization") or self.can_access(self.organization): return res return generic_message( request,