Content Blocks Introduction

In this module we will put collection of models/views/tags to make building CMS systems with Django easy. At the moment of this writing, the following helpers are made:

  • LinkList (used to build & display menus)
  • TextBlock (used to show text blocks on pages)

Installation

Follow standard procedure of setting up Django application. Exactly:

1. Checkout hdg modules (normally in a project root):

svn co http://svn.halogen-dg.com/svn/repos/hdg/trunk hdg

2. Add module to INSTALLED_APPS (in settings.py):

INSTALLED_APPS += (
    'hdg.djangoapps.ContentBlocks',
    )

3. Do 'syncdb'

manage.py syncdb

Usage

Look at  templatetags to understand what tags are available. Here is example template for links list (link_list.html):

{% if link_list %}
<div {% if link_list.css_class %}class="{{ link_list.css_class }}"{% endif %}>
  <ul>
    {% for link in link_list.links %}
    {% spaceless %}
    <li {% if link.css_class %}class="{{ link.css_class }}"{% endif %}>
      <a href="{{ link.href }}">{{ link.title }}</a>
    </li>
    {% endspaceless %}
    {% endfor %}
  </ul>
</div>
{% endif %}