From 1d2e1cb73f00ef7a1cf3fc22c6b87a1b34f26363 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 27 Nov 2018 21:13:41 +0100 Subject: [PATCH] form improvement --- rowers/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rowers/forms.py b/rowers/forms.py index 290e5f00..65122682 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -892,8 +892,11 @@ class RaceResultFilterForm(forms.Form): self.fields['boatclass'].choices = boatclasschoices # boattype - theboattypees = [record.boattype for record in records] - theboattypees = list(set(theboattypees)) + try: + theboattypees = [record.boattype for record in records] + theboattypees = list(set(theboattypees)) + except AttributeError: + theboattypees = [] if len(theboattypees)<= 1: del self.fields['boattype']