From f3b4195ecf141ed167a499b9e46a73f80dcc5f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Mon, 10 Oct 2016 13:55:18 +0200 Subject: [PATCH] fix track permissions --- accounts/models.py | 6 +++++- proposals/models.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/accounts/models.py b/accounts/models.py index 7b5b775..b97897f 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -92,12 +92,16 @@ class Participation(PonyConfModel): return self.orga def is_staff(self): - return self.is_orga() or self.topic_set.exists() + return self.is_orga() or self.topic_set.exists() or self.track_set.exists() @property def topic_set(self): return self.user.topic_set.filter(site=self.site) + @property + def track_set(self): + return self.user.track_set.filter(site=self.site) + @property def talk_set(self): return self.user.talk_set.filter(site=self.site) diff --git a/proposals/models.py b/proposals/models.py index 491bc5e..efee091 100644 --- a/proposals/models.py +++ b/proposals/models.py @@ -135,9 +135,9 @@ class Talk(PonyConfModel): return False if participation.orga: return True - if self.topics.filter(reviewers=participation.user).exists(): + if self.topics.filter(reviewers=user).exists(): return True - if self.track and self.track.managers.filter(user=participation.user).exists(): + if self.track and user in self.track.managers.all(): return True return False