Very simple CMS-like content blocks for use in a django project.
Features:
- Admin interface for creating/managing content blocks (including a rich text editor)
- Template tag for retrieving/displaying content block in a django project template. Django cache is leveraged, when possible, in loading content block.
Inspiration and more full featured version: django-tinycontent
Run: pip install django-richcontentblocks
Follow configuration instructions for ckeditor (skip this step if ckeditor is already configured).
Run migrations:
manage.py migrate
Add "richcontent" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'richcontentblocks', )
You should now have an admin tool with the ability to create rich content blocks.
An example of loading a rich content block, with a key value of my-block
in a template:
{% load rich_content_block_tags %} <div> the content block will be in next div </div> <div> {% rich_content_block 'my-block' %} </div>
The first time a content block loads, it will be placed in cache. Subsequent loads of the content block will use the cached item.
If an invalid content block key is used to when attempting to load a content object, an error message is displayed.