Catch AttributeError for 'person.sort_name' in assignment/models.py

This commit is contained in:
Emanuel Schuetze 2012-11-24 17:34:56 +01:00
parent bba301a4b3
commit e0ce1052c0

View File

@ -160,7 +160,10 @@ class Assignment(models.Model, SlideMixin):
participants = []
for candidate in candidates.all():
participants.append(candidate.person)
try:
participants.sort(key=lambda person: person.sort_name)
except AttributeError:
pass
return participants
#return candidates.values_list('person', flat=True)