skip to navigation
skip to content

Not Logged In

django-micro-cms 1.0

A micro-CMS for django. A bit like flatpages++.

Latest Version: 1.1.0

django-micro-cms
================

A micro-CMS for django. A bit like flatpages++.

It is **not** a fully-fledged CMS with online editing and media
management. All it does is allow you to manage pages and their
templates and translations in the admin (and display the pages on your
web site, naturally).


Installation
------------

``django-micro-cms`` has no external dependencies other than Django. It
was tested against Django 1.6. To install ``django-micro-cms``, simply

::

pip install django-micro-cms


There are two more things you have to do before you can use it on your page.

1. Add ``microcms`` to your installed apps::

INSTALLED_APPS = (
[...],
'microcms',
)

2. Add a URL config for your pages::

urlpatterns = patterns('',
url(r'^page(?P<url>/.*)$', 'microcms.views.pages', name='pages'),
url(r'^admin/', include(admin.site.urls)),
)

You can add more than one URL config for your pages, but all pages
will be available at each endpoint.



Usage
-----

Using ``django-micro-cms`` is quite simple: create templates, create
content, see it on the page. That's all. All of the editing is done in
the Django admin.


Templates
~~~~~~~~~

First you have to create one or more ``Template`` objects. These
templates will be rendered when you display a page with it. They can
``{% extend %}`` pages from your Django web-page, which is a good idea
if you have a base template, but they cannot themselves be
``extend``-ed.

Inside the template, you can use several variables to insert your
content:

``title``
The page title as a safe string.

``content``
The page content as a safe string.

``CONTENT_LANGUAGE_CODE``
The language code of the loaded content. This may be different from
the language code of the *page*, because the language code of the
page depends on the user preferences *and* the page URL (see below
for details on language-loading). However, the language code of the
content depends on the availability of content in that language. If
no content in the requested language is available, the fallback
language is used and that language code will be indicated here.

``created``
The date/time of the page creation.

``last_modified``
The date/time of the last modification of the page content.


Content
~~~~~~~

The second step is to create pages and content for them. Pages have a
``URL`` and a ``title``. The URL is the part of the page URL that
get's parsed out as the view parameter in your URL definition. So if
you have a page with ``/about/`` as URL and in your URL definition
this setup::

url(r'^page(?P<url>/.*)$', 'microcms.views.pages'),

then the full URL of that page will be::

/page/about/

The title attribute of the page will be available unescaped in the
template as variable ``title``.

For each page, you can add content. Only pages that have content parts
defined are shown. If a page has no content in the fallback language,
it will only be shown when the requested language version exists.

The ``content`` attribute of each language version is given to the
template unescaped.



On the page
~~~~~~~~~~~

Each page is available under its URL (once there is at least one
content part defined). Additionally, it is also available under its
URL with a language code prepended.

An example.

Let's say you have wired up the ``pages`` view as above, to be seen on
the page as ``^page(?P<url>/.*)$'``. Then each page you create will be
available at the URL you defined. For example, if you have pages with
URLS ``/about/``, ``/imprint/`` and ``/about/contact/``, the will be
available as::

/page/about/
/page/imprint/
/page/about/contact/

If a user requests the page in a locale that has defined content, then
the correct content will be served up. If you have content for locales
``en`` and ``de`` for example, and a user requests the page in German,
the ``de`` variant of the content will be served. If you have variants
in ``es`` and ``es-mx``, and a user requests content in ``es-ar``, the
``es`` variant will be served.

To allow serving specific languages, you can prepend the language code
to the page part of your URL. The above-outlined variants will be
available under the following URLs::

/page/en/about/
/page/de/about/
/page/es/about/
/page/es-mx/about/



LICENSE and COPYRIGHT
=====================

Copyright 2014 Johannes Spielmann <jps@shezi.de>

django-micro-cms is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

django-micro-cms is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with django-micro-cms, in a file called LICENSE in the root of
the project. If not, see <http: www.gnu.org="" licenses=""/>.  
File Type Py Version Uploaded on Size
django-micro-cms-1.0.tar.gz (md5) Source 2014-01-09 5KB
  • Downloads (All Versions):
  • 4 downloads in the last day
  • 39 downloads in the last week
  • 171 downloads in the last month