Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:36:15+00:00 2026-06-02T22:36:15+00:00

I have created two Dexterity types: lab_equipment.py, class_activity.py. The class_activity type contains the following

  • 0

I have created two Dexterity types: lab_equipment.py, class_activity.py.
The class_activity type contains the following relation to the lab_activity type:

class_activity.py:

class IClassActivity(form.Schema, IImageScaleTraversable):
[...]
    dexteritytextindexer.searchable('apparatus')
    apparatus = RelationList(
        title=_(u"Apparatus"),
        description=_(u"Choose equipment used in this activity"),
        value_type=RelationChoice(
            source=ObjPathSourceBinder(
                object_provides=ILabEquipment.__identifier__,
                navigation_tree_query= {'path': {'query':'/Plone/ug-demos/equipment'}},
            ),
        ),
    )

[...]

Now I need to list related members from the class_activity type in the lab_equipment page template.

Is there a way to reverse reference the RelationList from the class_activity type into the lab_activity type and then show this list into the page template?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:36:17+00:00Added an answer on June 2, 2026 at 10:36 pm

    To retrieve back-reference (all objects pointing to particular object using specified attribute) you can’t simply use from_object or from_path, because source object is stored in the relation without acquisition wrappers. You should use from_id and helper method, which search the object in the IntId catalog.

    from Acquisition import aq_inner
    from zope.component import getUtility
    from zope.intid.interfaces import IIntIds
    from zope.security import checkPermission
    from zc.relation.interfaces import ICatalog
    
    
    def back_references(source_object, attribute_name):
        """ Return back references from source object on specified attribute_name """
        catalog = getUtility(ICatalog)
        intids = getUtility(IIntIds)
        result = []
        for rel in catalog.findRelations(
                                dict(to_id=intids.getId(aq_inner(source_object)),
                                     from_attribute=attribute_name)
                                ):
            obj = intids.queryObject(rel.from_id)
            if obj is not None and checkPermission('zope2.View', obj):
                result.append(obj)
        return result
    

    Please note, this method does not check effective and expiration date or content language.

    In your case, you need to call this method from some method of lab equipment browser view and pass list of back referencing objects to your template. For example:

    class LabEquipmentView(BrowserView):
    
        def aparatus_backrefs(self):
            return back_references(self.context, 'apparatus')
    

    P.S. I copied the answer from my own Dexterity issue #234 I posted some time ago: http://code.google.com/p/dexterity/issues/detail?id=234&colspec=ID%20Type%20Status%20Priority%20Difficulty%20Milestone%20Owner%20Summary

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created two forms in my Windows Application. One Form acts as a
Let's say I have created two objects from class foo and now want to
I have created two wsdl files with shared types imported from xsd schema file.
I have created two separate objects, one of class Order and one of class
I have two Dexterity content types - Participant & Criterion - the latter of
I have created two classes, class A that uses a Linked List and class
I have created two buttons in a gridview. I wish to achieve the following
i have created two classes Standard and Family which extend abstract class Room ,
I have created two classes: public class Params : List<Param> { } public class
I have created two tables ORDERS and ORDERITEMS with the following constraint: alter table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.