Django app for determining site section by request.
Project description
Django app for determining site section by request.
Installation
Add section.context_processors.section to TEMPLATE_CONTEXT_PROCESSORS in your settings file:
TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.contrib.messages.context_processors.messages", "section.context_processors.section")
Add SECTIONS value 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 you’ll now automagically have a section variable added to context and available in your templates.
Otherwise have a look at RequestContext objects and how to use them:
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
django-section-0.0.1.tar.gz
(3.4 kB
view details)
Built Distributions
File details
Details for the file django-section-0.0.1.tar.gz
.
File metadata
- Download URL: django-section-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea1df6dc69b9a38cc0e26dfe844adb6459c7890a84adfe1789188ee1753eb2c5 |
|
MD5 | 216e690ab7db6a5b5bd54eda68d3569c |
|
BLAKE2b-256 | b34a5dee6c5b38e193ad75562c7265fa0c5873e1fb68b2d0457f603f9dbd8013 |
File details
Details for the file django_section-0.0.1-py2.6.egg
.
File metadata
- Download URL: django_section-0.0.1-py2.6.egg
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ac0afc1ecf1365f027a3c52c035af086e1730f9c88f091d0221ff9289bc6046 |
|
MD5 | 55b5022920be6534919607911b0a95c2 |
|
BLAKE2b-256 | 5b9b65e03d93292e26c42f9d928f4dafef9b313b8f0b15ffb9279ba0325e62d1 |
File details
Details for the file django_section-0.0.1-py2.5.egg
.
File metadata
- Download URL: django_section-0.0.1-py2.5.egg
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a2a661a5a30e6e1a2c211db3ad54aa80ed95cc5d8994e6022e93ab4cfdb4a93 |
|
MD5 | 731082ad262fdd83ee417ab8290014cc |
|
BLAKE2b-256 | ab902c0e7e4d820084b1510c90d49ce567964a09cd51acb1409b75cd2e3a3359 |