Data ModelΒΆ
Central to Widgy are Nodes, Contents, and Widgets. Node
is a subclass of Treebeard’s MP_Node
.
Nodes concern themselves with the tree structure. Each Node is associated with
an instance of Content
subclass. A Node + Content
combination is called a Widget.
Storing all the structure data in Node and having that point to any subclass of Content allows us to have all the benefits of a tree, but also the flexibility to store very different data within a tree.
Nodes
are associated with their
Content
through a
GenericForeignKey
.
This is what a hypothetical Widgy tree might look like.:
Node (TwoColumnLayout)
|
+-- Node (MainBucket)
| |
| +-- Node (Text)
| |
| +-- Node (Image)
| |
| +-- Node (Form)
| |
| +-- Node (Input)
| |
| +-- Node (Checkboxes)
| |
| +-- Node (SubmitButton)
|
+-- Node (SidebarBucket)
|
+-- Node (CallToAction)