from Products.AddRemoveWidget.AddRemoveWidget import AddRemoveWidget
...
atapi.LinesField(
'watershed',
storage=atapi.AnnotationStorage(),
widget=AddRemoveWidget(
label=_(u"Watershed"),
description=_(u"Enter one tag per line, multiple words allowed."),
),
vocabulary_factory='watershed',
),
AddRemoveWidget works with multiple-value fileds, if you need just single-value fields, try ComboBoxWidget instead. Example code looks like:
from Products.AddRemoveWidget.ComboBoxWidget import ComboBoxWidget
...
atapi.StringField(
'vote',
storage=atapi.AnnotationStorage(),
widget=ComboBoxWidget(
label=_(u"Best Band Ever"),
description=_(u"Single Choice."),
),
vocabulary=['The Beatles', 'The Smiths', 'Led Zeppelin', 'Joy Division'],
),
Look into the source code for more config options.
No comments:
Post a Comment