Skip to content

Commit

Permalink
[Finances: Fix] Fix error on missing Permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Mael Lacour committed Nov 29, 2018
1 parent 74df5f8 commit edf5404
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions finances/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit edf5404

Please sign in to comment.