Reputation: 25518
I'm new to Mezzanine, but I've got a project up and running and can generate customized Page
s using my own model. I'd now like to group these pages into sections (and maybe subsections) like this:
Section1
Subsection1
Page1.1.1
Page1.1.2
Subsection2
Page1.2.1
...
Section2
Subsection1
Page2.1.1
Page2.1.2
...
and so on. How can I attach my Page
objects to specific Section and Subsection categories (with an index page for each?) Do I need to create another Model to represent these categories and then a page_processor
to generate the index or is there an easier way?
Upvotes: 2
Views: 315
Reputation: 6967
In Mezzanine, your categories of Section1
, Subsection1
, etc. need to be pages as well.
Say you wanted the following structure:
Movies
Comedies
Monty Python and the Holy Grail
You would first create a Mezannine Page
(or RichTextPage
or similar) with title "Movies", and enter some content (even if minimal), such as "These are the movies I watch too much". This page will automatically contain links to any subpages once you create them.
To create a subpage like "Comedies", you would go to "Pages" under "Content" in the admin, and click on the "Add" dropdown menu in the "Movies" row you just created (and not the "Add" dropdown at the top-right of the page).
Follow the same pattern to create a subpage under "Comedies", and on that page ("Monty Python...") you'll likely enter the bulk of the content you actually want.
If it suits your needs, you can consider the other hierarchical pages to be nothing more than placeholder pages in a way, but those pages are usually a place to put content related to what the category itself is about.
The overall page structure will be mirrored in things like navigation menu dropdown trees.
Changing the structure of existing pages:
The Mezzanine Admin > Content > Pages page supports drag & drop for this.
Click a page's row near the right side (where the small up/down arrows are), and drag it to where you want it to go. A dotted outline will appear indicating where the dropped page will go, as you move the mouse around.
If you want to move your existing page to be a subpage of another, you can position the dotted outline below the intended parent page, and then move the mouse right or left before dropping the page. You will see the dotted outline's position change from indented to de-dented. Dropping while the outline is indented will create a subpage.
Note that the right/left mouse adjustment to get the indent/dedent might be somewhat finicky, depending on the mouse's position.
Upvotes: 4