Unverified Commit 154546b2 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Fix EventAdmin organiser checks

parent a987c950
...@@ -71,10 +71,12 @@ class EventAdmin(DoNextModelAdmin): ...@@ -71,10 +71,12 @@ class EventAdmin(DoNextModelAdmin):
def has_change_permission(self, request, event=None): def has_change_permission(self, request, event=None):
try: try:
if not request.user.is_superuser and event is not None: if (not request.user.is_superuser and event is not None and
event.organiser is not None):
committees = request.user.member.get_committees().filter( committees = request.user.member.get_committees().filter(
Q(pk=event.organiser.pk)).count() Q(pk=event.organiser.pk)).count()
return committees > 0 if committees == 0:
return False
except Member.DoesNotExist: except Member.DoesNotExist:
pass pass
return super().has_change_permission(request, event) return super().has_change_permission(request, event)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment