z3c.form

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?

血红的双手。 提交于 2019-12-12 17:26:07
问题 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__

Plone 4 dexterity viewform - add css Class to widget in fieldset X

梦想的初衷 提交于 2019-12-08 01:55:15
问题 I have a dexterity based content type with different edit views and fieldsets defined in the schema. Whenever I want to update a widget/field in another than the first fieldset, it gets crumpy. For example: self.groups[0].fields['my_field'].mode = HIDDEN_MODE must be used to hide my_field from the 2nd fieldset. To make the same field required self.schema['my_field'].required = True does the trick. But how can I add a css class to a widget on another than the first fieldset? I mean, what self