mgraf
(Michael)
December 18, 2018, 4:31pm
1
Is it possible to exclude all items with a specific Interface?
In our case, we have to not list all Working-Copies in RelatedItems Field - hide all items which have an "IWorkingCopy" Interface...
The other way is possible, i know ...
pattern_options={
'object_provides': IWorkingCopy.__identifier__
}
Thank you
jaroel
(Roel Bruggink)
December 18, 2018, 9:24pm
2
You could set a different vocabulary for the field, one that doesn't include IWorkingCopy items.
# -*- coding: utf-8 -*-
from plone.app.dexterity import _
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel import model
from plone.supermodel.directives import fieldset
from z3c.relationfield.schema import RelationChoice
from z3c.relationfield.schema import RelationList
from zope.interface import provider
@provider(IFormFieldProvider)
class IRelatedItems(model.Schema):
"""Behavior interface to make a Dexterity type support related items.
"""
relatedItems = RelationList(
title=_(u'label_related_items', default=u'Related Items'),
default=[],
This file has been truncated. show original
I imagine you could do this by using a custom behavior which extends IRelatedItems and defines its own relatedItems field.
Use that behavior instead of the IRelatedItems one and you should be good to go.