hasgeek / nodular

Reusable content objects for HasGeek apps
http://nodular.readthedocs.org/
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Use NodeAliases as attachments #8

Open jace opened 11 years ago

jace commented 11 years ago

If a page needs multiple fragments, these can be stored as sub-nodes of the page node. However, some nodes may need to be reused elsewhere (such as map markers) and cannot be stored as children of the page. They need to be siblings.

One way to attach sibling nodes to a page is via NodeAliases. An alias under the page can point to a node anywhere.

Nodes need a single method that returns a sub-node OR the node pointed to by an alias.

jace commented 11 years ago

Aliases have an existing advantage: if a fragment is created under a page and subsequently moved elsewhere, an alias will be automatically created.

jace commented 8 years ago

Because we're using lazy='dynamic' on the relationship, this can be inefficient, hitting the database twice, first to look for a node, second to look for an alias. We need a way to pre-load in such cases.

Perhaps we can have two relationships on Node, say .nodes which remains lazy='dynamic', and .allnodes which is a regular relationship. Neither loads anything until accessed, but the second will load all its contents at such a time. This makes sense in contexts such as loading page fragments.