Skip to content

Commit

Permalink
Simplified installation, removed some dependencies, improved document…
Browse files Browse the repository at this point in the history
…ation

- use brodie branch for Django piston (like Bitbucket itself does as well)
- removed django-staticfiles (is already in Django 1.3 contrib)
- removed unused Beautifulsoup
- split README into INSTALL and usage docs (in separate docs folder)
- installation instructions target Django 1.3, moved 1.2.x installation instructions to separate document
- added contributors
- bumped version to 0.9.4.5
  • Loading branch information
dbunskoek committed Jul 18, 2011
1 parent 2da84b0 commit 9805da6
Show file tree
Hide file tree
Showing 8 changed files with 546 additions and 221 deletions.
105 changes: 105 additions & 0 deletions INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
========================================
Installation instructions for Django 1.3
========================================


Installation:
=============

We're assuming you are using Django 1.3. If you need to install Django Fiber with an older Django version, you can find instructions in the docs folder.

::

$ pip install django-fiber


Requirements:
=============

These dependencies are automatically installed:

::

PIL>=1.1.7
django-piston==0.2.3rc1
django-mptt>=0.4.2
django-compressor>=0.7.1


Settings:
=========

settings.py
-----------

::

import django.conf.global_settings as DEFAULT_SETTINGS

MIDDLEWARE_CLASSES = DEFAULT_SETTINGS.MIDDLEWARE_CLASSES + (
'fiber.middleware.ObfuscateEmailAddressMiddleware',
'fiber.middleware.AdminPageMiddleware',
'fiber.middleware.PageFallbackMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.request',
'fiber.context_processors.page_info',
)

INSTALLED_APPS = (
...
'django.contrib.staticfiles',
'piston',
'mptt',
'compressor',
'fiber',
...
)

import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_FINDERS = DEFAULT_SETTINGS.STATICFILES_FINDERS + (
'compressor.finders.CompressorFinder',
)

urls.py
-------

::

from django.conf import settings

urlpatterns = patterns('',
...
(r'^api/v1/', include('fiber.api.urls')),
(r'^admin/fiber/', include('fiber.admin_urls')),
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages': ('fiber',),}),
...
)

if settings.DEBUG:
urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'),
)


Post-installation:
==================

Create database tables::

$ python manage.py syncdb

All static Fiber files need to be symlinked in (or copied to) your media folder::

$ python manage.py collectstatic --link


Documentation:
==============

You can find usage instructions, and other documentation, in the docs folder.
231 changes: 16 additions & 215 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ http://vimeo.com/ridethepony/django-fiber
Or, if you want to quickly try out Django Fiber on your machine, install the Django Fiber example project:
https://github.com/ridethepony/django-fiber-example

Convinced? Want to use Django Fiber in your own Django project? Follow the instructions below:
Convinced? Want to use Django Fiber in your own Django project? Then follow the instructions below:


Installation:
=============

We're assuming you are using Django 1.3. If you need to install Django Fiber with an older Django version, you can find instructions in the docs folder.

::

$ pip install django-fiber
Expand All @@ -26,20 +28,11 @@ These dependencies are automatically installed:

::

django-mptt>=0.4.2
django-piston==0.2.3rc1
beautifulsoup>=3.2.0
PIL>=1.1.7
django-staticfiles>=1.0.1
django-piston==0.2.3rc1
django-mptt>=0.4.2
django-compressor>=0.7.1

Optionally, you may need:

::

textile>=2.1.5
South>=0.7.3


Settings:
=========
Expand All @@ -49,26 +42,24 @@ settings.py

::

MIDDLEWARE_CLASSES = (
...
import django.conf.global_settings as DEFAULT_SETTINGS

MIDDLEWARE_CLASSES = DEFAULT_SETTINGS.MIDDLEWARE_CLASSES + (
'fiber.middleware.ObfuscateEmailAddressMiddleware',
'fiber.middleware.AdminPageMiddleware',
'fiber.middleware.PageFallbackMiddleware',
...
)

TEMPLATE_CONTEXT_PROCESSORS = (
...
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.request',
'staticfiles.context_processors.static_url',
'fiber.context_processors.page_info',
...
)

INSTALLED_APPS = (
...
'django.contrib.staticfiles',
'piston',
'mptt',
'staticfiles',
'compressor',
'fiber',
...
Expand All @@ -79,32 +70,10 @@ settings.py

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder',
STATICFILES_FINDERS = DEFAULT_SETTINGS.STATICFILES_FINDERS + (
'compressor.finders.CompressorFinder',
)


Optional settings:
==================

These settings are optional (default values are shown)::

FIBER_DEFAULT_TEMPLATE = 'base.html'
FIBER_TEMPLATE_CHOICES = []

FIBER_EXCLUDE_URLS = []

FIBER_IMAGES_DIR = 'uploads/images'
FIBER_FILES_DIR = 'uploads/files'

FIBER_METADATA_PAGE_SCHEMA = {}
FIBER_METADATA_CONTENT_SCHEMA = {}

COMPRESS = [the opposite of DEBUG]


urls.py
-------

Expand All @@ -121,7 +90,7 @@ urls.py
)

if settings.DEBUG:
urlpatterns += patterns('staticfiles.views',
urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'),
)

Expand All @@ -138,175 +107,7 @@ All static Fiber files need to be symlinked in (or copied to) your media folder:
$ python manage.py collectstatic --link


Usage:
======

At the beginning of your template(s), load the Fiber template tags::

{% load fiber_tags %}

Using the Fiber template tags, you can:

- write out content items, that either

- have a specified name
- are linked to a specific location on the current page
- are linked to a specific location on another page

- write out valid XHTML menu structures

- of pages below a named root page (this is the menu name),
- limited to a minimum and maximum level (depth),
- that mark the currently active page,
- optionally expanding all descendants of the currently active page,
- with all possible css hooks you could ever need


Content items
-------------

You can write out content items with the 'show_content' and 'show_page_content' template tags::

{% show_content "content_item_name" %}
{% show_page_content "block_name" %}
{% show_page_content other_page "block_name" %}

Examples
........

This shows content item named 'address'::

{% show_content "address" %}

This shows content items that are linked to the location named 'content' on the current page::

{% show_page_content "content" %}

This shows content items that are linked to the location named 'content' on another page 'other_page'::

{% show_page_content other_page "content" %}


Menus
-----

You can write out menus with the 'show_menu' template tag::

{% show_menu "menu_name" min_level max_level ["all_descendants / all"] %}

The menu name refers to a top-level node in the page tree.

Examples
........

The examples below assume the pages are structured like this:

- mainmenu

- Home
- About us

- Mission
- Our people

- Products

- Product A

- Testimonials
- Downloads

- Technical data sheet
- User manual

- Product B

- Downloads

- Product C

- Downloads

- Contact

- Newsletter
- Directions

- generalmenu

- Disclaimer
- Privacy statement

Main menu
.........

Show first and second level pages, below the root page named 'mainmenu'::

{% show_menu "mainmenu" 1 2 %}

When the user is currently visiting the 'Home' page, this will show (current pages are bold):

- **Home**
- About us
- Products
- Contact

When the user is currently visiting the 'Products' page, this will show:

- Home
- About us
- **Products**

- Product A
- Product B
- Product C

- Contact

As you can see, the sub pages of the currently active 'Products' page are automatically expanded.

When the user is currently visiting the 'Product A' page, this will show:

- Home
- About us
- **Products**

- **Product A**
- Product B
- Product C

- Contact

The sub pages of the 'Product A' page are not shown, because they are outside of the specified minimum and maximum levels.

Sub menu
........

Show pages from level 3 to 5, below the root page named 'mainmenu', and also show all descendants of the currently active page::

{% show_menu "mainmenu" 3 5 "all_descendants" %}

When the user is currently visiting the 'Home' page, this will show an empty menu, since it cannot be determined what level 3 pages are currently active.

However, when the user is currently visiting the 'Product A' page, this will show:

- **Product A**

- Testimonials
- Downloads

- Technical data sheet
- User manual

- Product B
- Product C

Notice that all pages below the currently active 'Product A' page are expanded because of the 'all_descendants' parameter.

Sitemap
.......

Show all pages, with all pages expanded::
Further documentation:
======================

{% show_menu "mainmenu" 1 999 "all" %}
{% show_menu "generalmenu" 1 999 "all" %}
You can find usage instructions, and other documentation, in the docs folder.
Loading

0 comments on commit 9805da6

Please sign in to comment.