One-Page design helper for Mezzanine.
This is some beta and only partially tested bits of code, use it only if you understand how it is suppose to work. Bug reports, comments and pull requests are welcome !
Some times you need to publish a shiny super cool one-page site on top of nifty bleeding edge JS and SASS technologies. But you still want your users able to manage their content as usual trough Mezzanine interface, i.e. let them add sections as it was pages.
This micro app provides a way to declare a page as being part of a “one page” design tree. When doing so, the page content is added to the parent’s content as an html 5 section with slugged page.title
as html id.
This works for RichTextPage
, Form
and Gallery
. Everything can be nested as usual and each page can still be accessed with its slug as before.
Forms are handled by a little bit of ajax and a custom page processor.
- Either clone this repository and copy the “onepage” directory in your Mezzanine project, or use pip :
pip install git+https://github.com/lucmilland/mezzanine-onepage
- edit your
settings.py
to addonepage
to yourINSTALLED_APPS
. - still in
settings.py
, add the requiredin_opd
extra model field :EXTRA_MODEL_FIELDS = ( ( "mezzanine.pages.models.Page.in_opd", "BooleanField", ("In a One-page design",), {"default": False}, ), )
- migrate your database if still not done :
python manage.py migrate onepage
That’s all, you’re done.
For each page that you want to include in it’s parent, just check the in a One-Page design
box in the admin.
Customizing templates/includes/*.html
and templates/pages/page.html
should provide you an easy way to adapt the default behaviour to your need ;)