Django app for determining site section by request.
Project description
Django Section
Django app for determining site section by request.
Installation
Add section.context_processors.section to your TEMPLATE_CONTEXT_PROCESSORS setting:
TEMPLATE_CONTEXT_PROCESSORS = ( ...other context processors..., "section.context_processors.section", )
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.
Changelog
0.0.2 (2011-08-24)
Docs, tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file django-section-0.0.3.tar.gz
.
File metadata
- Download URL: django-section-0.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88121c8877d9077f46e6c95cdb6b37d69b09f02ee70280b56ef715395937ace5 |
|
MD5 | d74c4177d445847a73b1d8e87495881b |
|
BLAKE2b-256 | 500f59727ed5c7ab99d30c59bc53abafffb34b2899f3ecfa1580999cc171c8e0 |
File details
Details for the file django_section-0.0.3-py2.7.egg
.
File metadata
- Download URL: django_section-0.0.3-py2.7.egg
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 613200870551d8dbf62dc88c381305b3a0999373de3517d39788444ec606aad4 |
|
MD5 | d84d02cea41444a967ecdd8b61226c87 |
|
BLAKE2b-256 | 7d5d1375824d2cb30b3ac017bc9dce36d98aef4d95bcad4a8011a0b65c012bf3 |
File details
Details for the file django_section-0.0.3-py2.6.egg
.
File metadata
- Download URL: django_section-0.0.3-py2.6.egg
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a4f62c9694c5021e19b3e422a2261782005df19615a680f1f0f8f560676ea0 |
|
MD5 | 13ea89676fa15d35320fee7cf1c4a5e8 |
|
BLAKE2b-256 | 595db19d4e2b44c738422a72ad74bef12db09283fa1163f7aebfa65ce2628c22 |