Node registry

The node registry is a place to list the relationships between node types and their views.

Nodular does not provide a global instance of NodeRegistry. Since the registry determines what is available in an app, registries should be constructed as app-level globals.

class nodular.registry.NodeRegistry

Registry for node types and node views.

register_node(model, view=None, itype=None, title=None, child_nodetypes=None, parent_nodetypes=None)

Register a node.

  • model (Node) – Node model.
  • view (NodeView) – View for this node type (optional).
  • itype (string) – Register the node model as an instance type (optional).
  • title (string) – Optional title for the instance type.
  • child_nodetypes (list) – Allowed child nodetypes. None or empty implies no children allowed.
  • parent_nodetypes (list) – Nodetypes that this node can be a child of.

The special value '*' in child_nodetypes implies that this node is a generic container. '*' in parent_nodetypes implies that this node can appear in any container that has '*' in child_nodetypes.

register_view(nodetype, view)

Register a view.

  • nodetype (string) – Node type that this view renders for.
  • view (NodeView) – View class.