A mezzanine flavored fork of [django-flatblocks] 1. The goal of this project is to be able to easily create custom blocks of text/HTML in the template, and can be editable via admin.
- Raw Text Block, Rich Text Block, Image Block
- Multisite support (via Mezzanine's Slugged).
- Frontend inline editing.
- Categories for easier block management.
- Optional MPTT support for categories.
- Optional unlimited passed arguments in the template
- Compatibility with modeltranslation.
Required - [Mezzanine CMS] 2
Optional - [Django MPTT] 3
- Add mezzanine_blocks to your virtualenv or clone the repository :
pip install git+git://github.com/renyi/mezzanine-blocks.git
- Add "mezzanine_blocks" to INSTALLED_APPS:
INSTALLED_APPS = (
"...",
"mezzanine_blocks",
)
- Add blocks menu item to admin menu (Optional):
ADMIN_MENU_ORDER = (
("Content", (
"pages.Page",
"mezzanine_blocks.Block",
"mezzanine_blocks.RichBlock",
"mezzanine_blocks.ImageBlock",
"blog.BlogPost",
"blog.BlogCategory",
"generic.ThreadedComment",
("Media Library", "fb_browse"),
)
),
)
- Run
python manage.py createdb
orpython manage.py syncdb && python manage.py migrate
.
-
Include block_tags in the template:
{% load ... block_tags %}
-
Insert block anywhere in the template:
{% flatblock "My Awesome Block" %}
{% richflatblock "My Awesome HTML Block" %}
{% imageflatblock "My Image Block" %}
-
You should see the blocks in the admin.
Options are similar to django-flatblocks.
{% flatblock {block} %}
{% flatblock {block} {timeout} %}
{% flatblock {block} using {tpl_name} %}
{% flatblock {block} using {tpl_name} {passed_args} %}
{% flatblock {block} {timeout} using {tpl_name} %}
{% flatblock {block} {timeout} using {tpl_name} {passed_args} %}
{% richflatblock {block} %}
{% richflatblock {block} {timeout} %}
{% richflatblock {block} using {tpl_name} %}
{% richflatblock {block} using {tpl_name} {passed_args} %}
{% richflatblock {block} {timeout} using {tpl_name} %}
{% richflatblock {block} {timeout} using {tpl_name} {passed_args} %}
{% imageflatblock {block} %}
{% imageflatblock {block} {timeout} %}
{% imageflatblock {block} using {tpl_name} %}
{% imageflatblock {block} using {tpl_name} {passed_args} %}
{% imageflatblock {block} {timeout} using {tpl_name} %}
{% imageflatblock {block} {timeout} using {tpl_name} {passed_args} %}
If you use {passed_args} to recover the arguments, add the tag {{passed_args}} in your template, if various arguments exists, add loop on {{passed_args}} exemple:
{% for args in passed_args %} {{args}} {% endfor%}
or directly by index: {{passed_args.0}} {{passed_args.1}} etc.
- Bumped version
- Compatibility with modeltranslation
- Bumped version to 0.9.5
- Fixed error if caching args not exist
- Bumped version to 0.9.4
- Added unlimited passed arguments in the template.
- Bumped version to 0.9.
- Added Image Block.
- Added Categories for easier block management (Optional MPTT).
- Added frontend inline editing tags to templates.
- Bugfix: Problem with slug when block title has whitespace.
- Cache key prefix now editable in defaults.py.
- Initial Release
- RawText block, and RichText block.
- Multisite support.