Plone Relations Sprint to improve dealing with Relations

This Saturday and Sunday a couple of Plonistas will sprint to improve dealing with relations in Plone 6

When?
30.01. and 31.01.2021 from 4pm-8pm UTC (5pm-9pm CET)

Where?
We'll meet at https://meet.zestsoftware.nl/plone

What about?

  1. Fix DataManagers and Converters if Relation-Fields to allow using different widgets without requiring the full objects in custom vocabularies as described in 43. Relations — Plone Training 2021 documentation

  2. Document best-practices and various options when working with relations in docs.plone.org and training.plone.org.

  3. Start including code from collective.relationhelpers in plone.api and CMFPlone

A question about Volto: Can I get Volto to respect a catalog-query that constrains the items that are allowed to be selected in a relationfield? This example does not work (it raises a ValidationErrorin plone.restapi.deserializer.dxcontent):

relation = RelationList(
    title='Only Documents and News',
    default=[],
    value_type=RelationChoice(
        source=CatalogSource(
            portal_type=['Document', 'News Item'],
            review_state='published',
        )
    ),
    required=False,
)

By the way: I only now figured out that the RelatedItemsFieldWidget has a search-mode that is great to set specifically when used with a CatalogSource query :slight_smile:

5 Likes

Voltos ObjectBrowserWidget can be forced to restrict selectable types via the Plone widget RelatedItemsFieldWidget: Just mention the selectableTypes.

myProjectsDocsAndNews = RelationList(
    title='Only Documents and News',
    default=[],
    value_type=RelationChoice(
        source=CatalogSource(
            portal_type=['Document', 'News Item'],
            review_state='published',
        )
    ),
    required=False,
)
directives.widget(
    "myProjectsDocsAndNews",
    RelatedItemsFieldWidget,
    pattern_options={
        "selectableTypes": ['Document', 'News Item'],
    },
)
2 Likes

We made excellent progress at the sprint. A sprint report is coming soon.

1 Like