Skip to main content

Django app for determining site section by request.

Project description

Django app for determining site section by request.

Installation

  1. 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")
  2. 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:

http://docs.djangoproject.com/en/dev/ref/templates/api/#id1

Project details


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)

Uploaded Source

Built Distributions

django_section-0.0.2-py2.6.egg (3.7 kB view details)

Uploaded Source

django_section-0.0.2-py2.5.egg (3.7 kB view details)

Uploaded Source

File details

Details for the file django-section-0.0.2.tar.gz.

File metadata

File hashes

Hashes for django-section-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c0579abba5c192012f5bb70cf0cad842ce77c0cbc2338530c1e13436ed186d6b
MD5 cb8231c0672fc3d037da4038452579cd
BLAKE2b-256 ec65ced4ab83647c307bbde859c6805cea9c34794c37667b21f414a961056cd4

See more details on using hashes here.

File details

Details for the file django_section-0.0.2-py2.6.egg.

File metadata

File hashes

Hashes for django_section-0.0.2-py2.6.egg
Algorithm Hash digest
SHA256 776baa03e6f4088c785b95709df4065de7ba3becb0c6403354dd8f7070660863
MD5 77517b929dc0a1feb20f4f4e82131d99
BLAKE2b-256 fb59a056e768a1a9f4e50a12548cf341fb1033281fe187cf6f783e63424206b3

See more details on using hashes here.

File details

Details for the file django_section-0.0.2-py2.5.egg.

File metadata

File hashes

Hashes for django_section-0.0.2-py2.5.egg
Algorithm Hash digest
SHA256 0f27ddc431a2d6bdbe0371f633e51d23de5d45bffa3cf98c2952b7ec2f3776b7
MD5 1f98350fbceb9115d79cfae16d2a01ae
BLAKE2b-256 74490bb376ef309e19b967da5813dd0bc3a269c3e1c389898772a6b1fc7299bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page