summaryrefslogtreecommitdiff
path: root/chimere/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/forms.py')
-rw-r--r--chimere/forms.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/chimere/forms.py b/chimere/forms.py
index 74b7aa0..107812b 100644
--- a/chimere/forms.py
+++ b/chimere/forms.py
@@ -297,10 +297,12 @@ class MarkerAdminFormBase(forms.ModelForm):
elif hasattr(self, 'categories_choices'):
self.fields['categories'].choices = self.categories_choices
# auto select if there is only one category
+ choices = list(self.fields['categories'].choices)
+ self.fields['categories'].choices = choices
self.fields['categories'].label = ""
- if (len(self.fields['categories'].choices) == 1):
+ if (len(choices) == 1):
self.fields['categories'].widget = forms.MultipleHiddenInput()
- choices = self.fields['categories'].choices
+ choices = list(self.fields['categories'].choices)
self.fields['categories'].label = u"{} / {}".format(
choices[0][0], choices[0][1][0][1])
self.fields['categories'].initial = \