zopefoundation / z3c.form

An advanced form and widget framework for Zope 3
Other
8 stars 39 forks source link

MultiWidget with RelationList as value_type #43

Open krissik opened 8 years ago

krissik commented 8 years ago

Hi all,

I`m not sure if this is the correct place for my question - please let me know if it is not.

I would like to have a dictionary with RelationList as value_type in plone:

    dictWithRelations = schema.Dict(title=u"Some Relations lists",
                                    required=False,
                                    key_type=schema.TextLine(title=_(u'afield')),
                                    value_type=relationfieldschema.RelationList(
                                       title=_(u'relations'),
                                       default=[],
                                       value_type=relationfieldschema.RelationChoice(
                                           source=CatalogSource(portal_type=['Document', 'Folder'])
                                       ),
                                       required=False,
                                    ))

But the RelatedItemsWidget does not show any item to select. The problem is described in more detail here: https://community.plone.org/t/dictionary-with-relationlists-as-value-type/1984

I have debugged and now it seems to me that the RelatedItemsWidget is missing context. The docstring of MultiWiget says:

Based on the nature of this (sub) widget setup the internal widget do not have a real context and can't get bound to it.

Is this the reason why this is not working? What do I have to implement to make it work?

I`m happy about every hint!