Stuart Dines
Team Leader / Senior Software Engineer @ The Interaction Consortium http://interaction.net.au/
Senior Software Engineer @ Stockspot http://stockspot.com.au
@sjdines
http://stuartdines.com
28th of January 2016
# To install mezzanine_fluent_pages (after Mezzanine has been installed) run:
$ pip install -e git+ssh://git@github.com/sjdines/mezzanine-fluent-pages#egg=mezzanine-fluent-pages
# Then add the page type(s) you wish to INSTALLED_APPS:
INSTALLED_APPS += (
'mezzanine_fluent_pages.mezzanine_page',
'mezzanine_fluent_pages.mezzanine_layout_page',
'django_wysiwyg',
'fluent_contents',
'fluent_contents.plugins.text',
)
# Define the location of MEZZANINE_PAGES_TEMPLATE_DIR.
MEZZANINE_PAGES_TEMPLATE_DIR = os.path.join(PROJECT_ROOT, "<project name>", "templates")
# Create a folder named `templates` in your project folder. If you choose to use the layout system all your
# layouts will need to go in this folder.
$ mkdir <project name>/templates
# Run migrations:
$ python manage.py migrate
from fluent_contents.models import PlaceholderField
from mezzanine.pages.models import Page
class FluentContentsPage(Page):
"""
A mezzanine `Page` type with fluent contents.
"""
content = PlaceholderField('mezzanine_page_content')
def get_template_name(self):
"""
Obtain the template to use for front end rendering.
:return: String of template location.
"""
return 'fluent_mezzanine/fluent_contents_page.html'
from django.contrib import admin
from fluent_contents.admin import PlaceholderFieldAdmin
from mezzanine.pages.admin import PageAdmin
from . import models
class FluentContentsPageAdmin(PlaceholderFieldAdmin, PageAdmin):
"""
Admin definition for `FluentContentsPage`.
"""
fieldsets = PageAdmin.fieldsets + (
(
None,
{
'fields': ['content', ]
}
),
)
admin.site.register(models.FluentContentsPage, FluentContentsPageAdmin)
{% extends 'base.html' %}
{% load fluent_contents_tags %}
{% block main %}
{% render_placeholder page.get_content_model.content %}
{% endblock %}
Demonstrate setting up a project
Massive thanks have to go to:
Stuart Dines
Team Leader / Senior Software Engineer @ The Interaction Consortium http://interaction.net.au/
Senior Software Engineer @ Stockspot http://stockspot.com.au
@sjdines
http://stuartdines.com