Skip to main content

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.

Metadata

Release files for django-section 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-section 0.0.3
File Size Uploaded
django-section-0.0.3.tar.gz 4.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for django-section 0.0.3
File Interpreter ABI Platform
django_section-0.0.3-py2.7.egg Legacy Egg format - - Details
django_section-0.0.3-py2.6.egg Legacy Egg format - - Details

Total release size: 16.7 kB

Release files / django-section-0.0.3.tar.gz

Download URL django-section-0.0.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
88121c8877d9077f46e6c95cdb6b37d69b09f02ee70280b56ef715395937ace5
BLAKE2b-256 checksum
How to use checksums
500f59727ed5c7ab99d30c59bc53abafffb34b2899f3ecfa1580999cc171c8e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_section-0.0.3-py2.7.egg

Download URL django_section-0.0.3-py2.7.egg
Size 6.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
613200870551d8dbf62dc88c381305b3a0999373de3517d39788444ec606aad4
BLAKE2b-256 checksum
How to use checksums
7d5d1375824d2cb30b3ac017bc9dce36d98aef4d95bcad4a8011a0b65c012bf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_section-0.0.3-py2.6.egg

Download URL django_section-0.0.3-py2.6.egg
Size 6.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
22a4f62c9694c5021e19b3e422a2261782005df19615a680f1f0f8f560676ea0
BLAKE2b-256 checksum
How to use checksums
595db19d4e2b44c738422a72ad74bef12db09283fa1163f7aebfa65ce2628c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

3 release files

0.0.2

3 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page