Fixed attribute error if anonymous opens application/assignment view.

This commit is contained in:
Emanuel Schuetze 2012-09-19 14:16:17 +02:00
parent 4cd1ad5954
commit 9f9ea81fc6
2 changed files with 8 additions and 2 deletions

View File

@ -164,7 +164,10 @@ class Application(models.Model, SlideMixin):
yield object.person yield object.person
def is_supporter(self, 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 @property
def enough_supporters(self): def enough_supporters(self):

View File

@ -122,8 +122,11 @@ class Assignment(models.Model, SlideMixin):
""" """
return True, if person is a candidate. 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() .exclude(blocked=True).exists()
except AttributeError:
return False
def is_blocked(self, person): def is_blocked(self, person):
""" """