Hi all
I have got a behavior that extends the schema of a type with some fields. Now I want to add a field that is a dictionary and its value_type
should be a RelationList.
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,
))
After I have assigned this behavior to Documents I can create a Document and see my new field. I can add items to that field but if I try to add a relation the widget says "Loading failed". In my browsers development console I can see error 404 for this Url:
If I add a RelationList
field to my behavior schema directly everything work as expected:
relations = relationfieldschema.RelationList(title=_(u'relations'),
default=[],
value_type=relationfieldschema.RelationChoice(
source=CatalogSource(portal_type=['Document', 'Folder'])
),
required=False,
)
I have tried changing source=CatalogSource(portal_type=['Document', 'Folder'])
to vocabulary='plone.app.vocabularies.Catalog'
as well. In this case the RelationList added directly to the schema works but the one in the dictionary does not work too. The error in browsers development console is:
select2.js:1800 Uncaught TypeError: Cannot read property 'length' of undefined http://localhost:8082/Plone/++plone++static/components/select2/select2.js
I hope someone can help or show the correct way to have a Dictionary with RelationLists.