Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Django app for determining site section by request.

Project Description

Django Section

Django app for determining site section by request.

Installation

  1. Add section.context_processors.section to your TEMPLATE_CONTEXT_PROCESSORS setting:

    TEMPLATE_CONTEXT_PROCESSORS = (
        ...other context processors...,
        "section.context_processors.section",
    )
    
  2. Add SECTIONS setting to your settings file in the form:

    # Tuple of dictionaries used to match URL pattern names to site sections.
    # example: ({'name': '<section name>', 'matching_pattern_names': ('<url_name1>', '<url_name2>')},)
    SECTIONS = (
        {'name': 'home', 'matching_pattern_names': ('home',)},
    )
    

Usage

If you’re using generic views or RequestContext you’ll now automagically have a section variable added to context and available in your templates containing the value of name as defined for the current view in your SECTIONS setting.

NOTE: If the current path can not be resolved to a defined section, the first section as defined in the SECTION settings is returned. This allows you to setup a global fallback section, i.e. home.

Authors

Praekelt Foundation

  • Shaun Sephton

Changelog

0.0.2 (2011-08-24)

  1. Docs, tests.
Release History

Release History

This version
History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_section-0.0.3-py2.6.egg (6.4 kB) Copy SHA256 Checksum SHA256 2.6 Egg Aug 24, 2011
django_section-0.0.3-py2.7.egg (6.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg Aug 24, 2011
django-section-0.0.3.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Aug 24, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting