plone / plone.api

The Plone API
https://6.docs.plone.org/plone.api
Other
89 stars 54 forks source link

Support references #223

Open jaroel opened 9 years ago

jaroel commented 9 years ago

Somehow get references and/or referenced objects.

For getting the objects, use get_referred_from and get_referred_to:

>>> plone.api.content.get_referred_from(context, name=None)
[<Folder at...>, <Document at...>,]

>>> plone.api.content.get_referred_to(context, name=None)
[<Folder at...>, <Document at...>,]

For getting the actual references, use get_references_from:

>>> plone.api.content.get_references_from(context, name=None)
[<Products.Archetypes.ReferenceEngine.plugbrains at...>, <Products.Archetypes.ReferenceEngine.plugbrains at...>,]

>>> plone.api.content.get_references_to(context, name=None)
[<Products.Archetypes.ReferenceEngine.plugbrains at...>, <Products.Archetypes.ReferenceEngine.plugbrains at...>,]
jaroel commented 9 years ago

How would this work in Dexterity?

jensens commented 4 years ago

There was no activity on this for a while. I close this request for now. If you plan to work further on this please reopen and go on.

pbauer commented 4 years ago

Reopening this based on the discussion in https://community.plone.org/t/new-addon-collective-relationhelpers-to-manage-create-export-and-rebuild-relations/12365.

Proposal: Add link_objects (https://github.com/collective/collective.relationhelpers/blob/master/src/collective/relationhelpers/api.py#L213) and get_relations (https://github.com/collective/collective.relationhelpers/blob/master/src/collective/relationhelpers/api.py#L279) to content.py.

TODOs: