From 9f9ea81fc698c5ec0adfbeb06eef90328a795d3b Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 19 Sep 2012 14:16:17 +0200 Subject: [PATCH] Fixed attribute error if anonymous opens application/assignment view. --- openslides/application/models.py | 5 ++++- openslides/assignment/models.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openslides/application/models.py b/openslides/application/models.py index df1d8195f..bac0f47f0 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -164,7 +164,10 @@ class Application(models.Model, SlideMixin): yield object.person def is_supporter(self, person): - return self.applicationsupporter_set.filter(person=person).exists() + try: + return self.applicationsupporter_set.filter(person=person).exists() + except AttributeError: + return False @property def enough_supporters(self): diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index dcd8a6e15..19c9886bf 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -122,8 +122,11 @@ class Assignment(models.Model, SlideMixin): """ return True, if person is a candidate. """ - return self.assignment_candidats.filter(person=person) \ + try: + return self.assignment_candidats.filter(person=person) \ .exclude(blocked=True).exists() + except AttributeError: + return False def is_blocked(self, person): """