The fluentpage page type¶
The fluentpage provides a page type where parts of the page can be filled with flexible content blocks.
This feature is provided by django-fluent-contents.
The combination of django-fluent-pages and django-fluent-contents provides the most flexible page layout. It’s possible to use a mix of standard plugins (e.g. text, code, forms) and customly defined plugins to facilitate complex website designs. See the documentation of django-fluent-contents for more details.
Installation¶
Install the dependencies via pip:
pip install django-fluent-pages[fluentpage]
pip install django-fluent-contents[text]
This installs the django-fluent-contents package.
Add the following settings to settings.py
:
INSTALLED_APPS += (
'fluent_pages.pagetypes.fluentpage',
'fluent_contents',
# The desired plugins for django-fluent-contents, e.g:
'fluent_contents.plugins.text',
'django_wysiwyg',
)
Template design¶
To render the page, include the tags that django-fluent-contents uses to define placeholders. For example:
{% extends "mysite/base.html" %}
{% load placeholder_tags %}
{% block main %}
<section id="main">
<article>
{% block pagetitle %}<h1 class="pagetitle">{{ page.title }}</h1>{% endblock %}
{% page_placeholder "main" role='m' %}
</article>
<aside>
{% page_placeholder "sidebar" role='s' %}
</aside>
</section>
{% endblock %}
These placeholders will be detected and displayed in the admin pages.
Place the template in the template folder that FLUENT_PAGES_TEMPLATE_DIR points to.
By default, that is the first path in TEMPLATE_DIRS
.
Configuration¶
The page type itself doesn’t provide any configuration options, everything can be fully configured by configuring django-fluent-contents. See the documentation of each of these bundled content plugins to use them:
- The code plugin
- The commentsarea plugin
- The disquscommentsarea plugin
- The formdesignerlink plugin
- The gist plugin
- The googledocsviewer plugin
- The iframe plugin
- The markup plugin
- The oembeditem plugin
- The rawhtml plugin
- The sharedcontent plugin
- The text plugin
- The twitterfeed plugin
Creating new plugins¶
A website with custom design elements can be easily editable by creating custom plugins.
Creating new plugins is not complicated at all, and simple plugins can can easily be created within 15 minutes.
The documentation of django-fluent-contents explains how to create new plugins in depth.
Advanced features¶
This module also provides the FluentPageBase
and FluentPageAdmin
classes,
which can be used as base classes for custom page types
that also use the same layout mechanisms.