From edf54040bb7d4d956a8c6addd057594695cf549d Mon Sep 17 00:00:00 2001 From: Mael Lacour Date: Thu, 29 Nov 2018 19:03:18 +0100 Subject: [PATCH] [Finances: Fix] Fix error on missing Permission --- finances/views.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/finances/views.py b/finances/views.py index a709a3c8..7272dd10 100644 --- a/finances/views.py +++ b/finances/views.py @@ -953,12 +953,18 @@ def get_context_data(self, **kwargs): se.number_participants = se.get_number_participants() se.total_weights_registrants = se.get_total_weights_registrants() se.total_weights_participants = se.get_total_weights_participants() - se.has_perm_manage = (self.request.user == se.manager or - Permission.objects.get(codename='manage_sharedevent') in self.group.permissions.all()) + try: + se.has_perm_manage = (self.request.user == se.manager or + Permission.objects.get(codename='manage_sharedevent') in self.group.permissions.all()) + except ObjectDoesNotExist: + se.has_perm_manage = False context['shared_events'] = shared_events # Permission SelfRegistration - if Permission.objects.get(codename='self_register_sharedevent') in self.group.permissions.all(): - context['has_perm_self_register_sharedevent'] = True + try: + if Permission.objects.get(codename='self_register_sharedevent') in self.group.permissions.all(): + context['has_perm_self_register_sharedevent'] = True + except ObjectDoesNotExist: + pass return context