Blanc Basic Pages Documentation¶
Contents:
Overview¶
What is blanc-basic-pages?¶
blanc-basic-pages is a simple Django package which acts as a replacement for
flatpages
.
Certain features of flatpages have been removed to make administration easier, and other features have been added.
Design notes¶
Page Tree¶
Pages uses the django-mptt package to organise the page tree hierarchy. By using a page tree it allows site managers to use the Django admin to organise the navigation used on the site without having to edit any templates.
Sites framework removed¶
To remove complexity, the sites
framework dependency
has been removed. This removes the risk of the same URL being used multiple
times and causing a MultipleObjectsReturned
exception, as well as making
it easier to use a page tree.
Templates configurable as a setting¶
The admin for pages limits the options for templates to the choices available in the select box. Site staff can pick a defined template instead of having to enter the filename of a template.
This list of templates is configurable as PAGE_TEMPLATES
in your project
settings file.
Errors will generate exceptions¶
Flatpages catches any exceptions and serves an error 404 page, which is a sane default given that site staff can cause problems by choosing an invalid template. As the pages admin restricts this, any exceptions for pages will be raised and not ignored.
Installation¶
Requirements¶
Before installing blanc-basic-pages, you’ll need a copy of Django__ 1.7, django-mptt__ 0.6.1 and django-mptt-admin installed.
Installing blanc-basic-pages¶
The fastest way of installing is to use pip__.
Simply type:
pip install blanc-basic-pages
Manual installation¶
Alternative you manually install by downloading the latest version from the `blanc-basic-pages page on the Python Package Index`__.
Download the package, unpack it and run the setup.py
installation
script:
python setup.py install
Configuring your project¶
Edit your Django project’s settings module, ensure that the required
dependencies are installed and configured, then add blanc_basic_pages
to
INSTALLED_APPS
:
INSTALLED_APPS = (
...
'mptt',
'django_mptt_admin',
...
'blanc_basic_pages',
)
Once this is done, run python manage.py migrate
to update your database.
Settings¶
PAGE_TEMPLATES¶
Default:
PAGE_TEMPLATES = (
('', 'Default'),
)
A list of two-tuples in the format (filename
, template name
). The
empty default template will use pages/default.html
.
You can add more template choices by extending this list:
PAGE_TEMPLATES = (
('', 'Default'),
('pages/homepage.html', 'Home Page'),
)
PAGE_SHOW_LOGIN¶
Default: False
Shows or hides the login required option in the pages Django admin. By default
this is False
as most sites won’t have a pages protected by username and
password authentication - so we hide it.
If your site needs certain pages to be protected so that only logged-in users
are able to view them, change this to True
and then the option will appear
in the Django admin.
PAGE_SHOW_HERO_IMAGE¶
Default: True
Shows or hides the Hero Image field for pages in the Django admin. By default
this is True
, however if the site has no need for hero images in pages then
this can be turned off.