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.2.tar.gz
(3.1 kB
view details)
Built Distributions
File details
Details for the file django-section-0.0.2.tar.gz
.
File metadata
- Download URL: django-section-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0579abba5c192012f5bb70cf0cad842ce77c0cbc2338530c1e13436ed186d6b |
|
MD5 | cb8231c0672fc3d037da4038452579cd |
|
BLAKE2b-256 | ec65ced4ab83647c307bbde859c6805cea9c34794c37667b21f414a961056cd4 |
File details
Details for the file django_section-0.0.2-py2.6.egg
.
File metadata
- Download URL: django_section-0.0.2-py2.6.egg
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776baa03e6f4088c785b95709df4065de7ba3becb0c6403354dd8f7070660863 |
|
MD5 | 77517b929dc0a1feb20f4f4e82131d99 |
|
BLAKE2b-256 | fb59a056e768a1a9f4e50a12548cf341fb1033281fe187cf6f783e63424206b3 |
File details
Details for the file django_section-0.0.2-py2.5.egg
.
File metadata
- Download URL: django_section-0.0.2-py2.5.egg
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f27ddc431a2d6bdbe0371f633e51d23de5d45bffa3cf98c2952b7ec2f3776b7 |
|
MD5 | 1f98350fbceb9115d79cfae16d2a01ae |
|
BLAKE2b-256 | 74490bb376ef309e19b967da5813dd0bc3a269c3e1c389898772a6b1fc7299bb |