The illustration shows what we might expect:
We have selected a Contact
and its details are available for editing, including a reference to an Account
. Now on the left, however, we have a sidebar showing the available one-to-many relations, in this case, the only one-to-many relation applicable to a Contact
is Address
.
To show a list of entities, we already have a suitable building block, the Browse
class that will not only let us browse a list of entities in various ways, but is also capable of filtering those entities. In this example, we would want to show just those addresses that are associated with this specific contact.
We therefore add a new method to the Display
class that will produce an HTML fragment together with some JavaScript to show the list of available one-to-many relations:
Chapter9/display.py
@staticmethod def related_link(re,e): return '<li id="%s" class="%s" ref="%s">%s</li>'%...