Plone/z3c.form 3.2.1- How can I make an autocomplete widget (that is not a required field) use a custom binded source object?
问题 I'm trying to get an autocomplete widget to render in a form (z3c.form), using a binded source object. In the interface class: Parent = schema.Choice(title=u'A Parent', source=ParentSourceBinder(), required=False, default=None) In my form.Form class: fields['Parent'].widgetFactory = AutocompleteFieldWidget I'm using a custom source binder because I need to pull data from a database. class ParentSource(object): implements(IQuerySource) vocabulary = SimpleVocabulary([]) session = None __iter__