{ "info": { "author": "Praekelt Consulting", "author_email": "dev@praekelt.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Django Composer\n===============\n**Build Pages by composing listings and individual content**\n\n.. image:: https://travis-ci.org/praekelt/django-composer-prk.svg?branch=develop\n :target: https://travis-ci.org/praekelt/django-composer-prk\n\n.. image:: https://coveralls.io/repos/github/praekelt/django-composer-prk/badge.svg?branch=develop\n :target: https://coveralls.io/github/praekelt/django-composer-prk?branch=develop\n\n.. contents:: Contents\n :depth: 5\n\nQuick start\n-----------\n\n``django-composer-prk`` is intended to be a standalone library, not a project, but it can indeed be run with::\n\n - virtualenv ve\n - ./ve/bin/pip install -r composer/tests/requirements/19.txt\n - ./ve/bin/python manage.py migrate --run-syncdb --settings=composer.tests.settings.19\n - ./ve/bin/python manage.py runserver 0.0.0.0:8000 --settings=composer.tests.settings.19\n\n\nInstallation\n------------\n\n#. Install the contents of ``composer/tests/requirements/19.txt`` to your Python environment.\n\n#. Add ``composer`` to the ``INSTALLED_APPS`` setting.\n\n#. Add ``composer.middleware.ComposerFallbackMiddleware`` to the middleware setting. This will **REPLACE** the flatpages 404 middleware, so remove that if needed.\n\n#. Add ``composer.context_processors.slots`` to the context processors setting.\n\n#. Add the following to your urls.py\n\n::\n\n url(r\"^nested_admin/\", include(\"nested_admin.urls\"))\n\nContent types\n-------------\n\nSlot:\n\n* url: The URL or URL pattern where the slot should appear. This may be a regular expression.\n\n* slot_name: In your project, the slot names are defined in ``templates/base.html``. This field provides options that are automatically generated from the composer slots found in that base template.\n\nRow:\n\n* Each row is nested within a slot (ordered).\n\n* The row can have extra CSS classes.\n\nColumn:\n\n* Each column is nested within a row (ordered).\n\n* width: A row is 12 columns wide, so columns can be fitted next to each other.\n\n* title: rendered at the top of a column. Can be blank.\n\n* class_name: Extra CSS classes that can be added to the column wrapping div.\n\nTile:\n\n* Each tile is nested within a column (ordered).\n\n* The tile target is a generic foreign key, so it can reference any content type.\n\n* The view name can be any Django named view.\n\n* Markdown is ad-hoc content. The admin UI for markdown is currently not optimal and requires a visit to the ``Tiles`` list.\n\n* style: The style is used to look up a suitable template for rendering the target. An example is ``templates/myapp/inclusion_tags/mymodel_tile.html``.\n\n* class_name: The extra CSS classes to add to the tile.\n\nUsage\n-----\n\nThe base template usually defines some composer slots. Typically this would be\na header slot, content slot and footer slot. This can be extended easily by\nadding slots to the ``templates/base.html`` template. Example of adding a\nsidebar slot: ::\n\n {% if composer_slots %}{% load composer_tags %}{% endif %}\n\n {% if composer_slots.sidebar %}\n
\n {% endif %}\n\nOn any URL on the site, if an appropriate slot exists that matches the URL and slot name, that slot will be rendered on the page. The current matching logic works as follows:\n\n#. Find the slot with the best possible match for the current URL. Slot URL's are treated as regular expressions so one slot can match many URL's.\n\nThe content slot is special:\n\n#. If the template being rendered fills the content block then it trumps any slot that may try to fill the content block.\n\nSettings\n--------\n\nYou need to define the types of tiles available to the system in settings. The\n``tile`` style is added implicitly. See the tile rendering section on how to\ncreate the corresponding templates: ::\n\n COMPOSER = {\"styles\": ((\"block\", \"Block\"), (\"tiny\": \"Tiny\"))}\n\nIf you would like the styles to be inferred from all the installed apps add: ::\n\n COMPOSER = {\"load-existing-styles\": {\"greedy\": True}}\n\nIt will attempt to add all styles that are already tied to apps and models that follow the correct naming convention.\nCan be used in tandem with the ``styles`` setting.\n\nAlternatively entire apps and specific app models can be excluded or included.\n\nIncluding: ::\n\n COMPOSER = {\"load-existing-styles\": {\"includes\": {\"