[Product-Developers] Attaching plone.app.widgets to a custom Dexterity schema.

Philip Bauer bauer at starzel.de
Sat Mar 8 20:23:00 UTC 2014


Thank you, David, that's great news indeed!
Philip

Am 08.03.2014 um 20:18 schrieb David Glick (Plone) <david.glick at plone.org>:

> 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
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20140308/52b9e979/attachment.asc>


More information about the Product-Developers mailing list