On 2/26/14, 12:28 PM, ajung wrote:
I have a custom Dexterity type with a RelationField
54 media = RelationChoice($
55 title=_(u"label_podcast_item_media"),$
56 description=_(u"help_podcast_item_media"),$
57
source=ObjPathSourceBinder(object_provides=IMediaItem.__identifier__),$
58 required=False,$
59 ) $
that should make use of the plone.app.widgets's widget of the related items
field.
I was reading through dx.py and dx_bbb.py but I don't get the point how to
reuse
the existing widget here. Any pointer?
This week I did some work on adding support for sources in
plone.app.widgets.
Now, with master of plone.app.vocabularies and plone.app.widgets, you
can import plone.app.vocabularies.catalog.CatalogSource and do this:
media = RelationChoice(
title=_(u"label_podcast_item_media"),
description=_(u"help_podcast_item_media"),
source=CatalogSource(object_provides=IMediaItem.__identifier__),
required=False,
)
and it will query the source when searching in the widget.
With my changes it's also now possible to use a plain Choice field with
this source instead of RelationChoice, if you want to store a UUID
rather than creating a relation.
David
_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers