[Zope3-Users] default values in Choice fields
David Johnson
djohnson at jsatech.com
Thu Feb 9 09:19:39 EST 2006
> fruit = Choice(title=u'Fruit',
> description=u'An example choice field',
> default=None,
> required=True,
> values=('Apple', 'Orange', 'Banana', 'Strawberry'))
>
> I want to specify a default value for this field but I want it to be
> from the list of values.
For once I think I might be able to answer something. Through the ZMI these
choices should be verified automatically. However, in your implementation
class you may want to consider the following:
class MyFruitClass(Persistent,Contained):
fruit = FieldProperty(IMyFruitClass['fruit'])
I use this and have found it to work well(if I understand you). I poached
this from Phillip's _Web Component Development_ book (section 5.2).
More information about the Zope3-users
mailing list