fields: fix calculation of first element length in item field

This commit is contained in:
Frédéric Péters 2012-11-05 17:30:26 +01:00 committed by Thomas NOEL
parent 8137ebd93a
commit d9ad5b0e66
1 changed files with 5 additions and 1 deletions

View File

@ -684,7 +684,11 @@ class ItemField(WidgetField):
kwargs['options'] = [(None, '---')]
if self.show_as_radio:
self.widget_class = RadiobuttonsWidget
if len(kwargs['options']) > 3 or len(kwargs['options'][0][1]) > 10:
if type(kwargs['options'][0]) is str:
first_item = kwargs['options'][0]
else:
first_item = kwargs['options'][0][1]
if len(kwargs['options']) > 3 or len(first_item) > 10:
# TODO: absence/presence of delimitor should be an option
kwargs['delim'] = htmltext('<br />')