Skip to main content

Django app allowing for configurable targetting of template inclusion tags.

Project description

Django app allowing for configurable targetting of template inclusion tags.

Installation

  1. Add gizmo to your INSTALLED APPS setting.

  2. Add ROOT_GIZMOCONF value to your projects settings file. This specifies the module in which your configured your gizmos, i.e.:

    ROOT_GIZMOCONF = 'project.gizmos'

    In this case we have a module called project containing a gizmos.py file.

  3. Create your gizmos config (in this cased named gizmos.py) file in the form:

    gizmos = (
        ('<loader name>', '<tag name>', '<slot name>', [['<url_name'>, ]]),
    )

With:

  • <loader name> being the name you would normally pass to Django’s load tag, i.e. myapp_inclusion_tags for {% load myapp_inclusion_tags %}.

  • <tag name> being the name of the tag you want to include, i.e. advert for {% advert %}.

  • <slot name> being the name of the slot you want the tag to show up in, i.e. home.

  • <url_name> optional being the names of the urls you want the tag to show up in, i.e. home.

Usage

Gizmos are stock standard Django inclusion tags. The only diffirence is that instead of specifying tags within a template you specify tags from a distance by using a gizmo conf file in conjunction with the gizmos tag.

For example, lets say we have an advert tag specified in myapp’s inclusion tags which we only want to call in the gizmo slot named advert for the url named home:

  1. Create your tags as normal.

  2. Create your gizmos config file in the form:

    gizmos = (
        ('myapp_inclusion_tag', 'advert', 'advert', ['home', ]),
    )
  3. In your template for the home view load the gizmo inclusion tags and include a gizmos tag with a slot name of advert:

    {% load gizmo_inclusion_tags %}
    
    ...some html...
    
    {% gizmos 'home_advert' %}
    
    ...some more html...

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-gizmo-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_gizmo-0.0.2-py2.7.egg (12.3 kB view details)

Uploaded Egg

django_gizmo-0.0.2-py2.6.egg (12.4 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: django-gizmo-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-gizmo-0.0.2.tar.gz
Algorithm Hash digest
SHA256 76449438c7dcb2961747e1839bbbdbae0b3b3ce3da8bc81b9cbe1a367a52014b
MD5 a41d26970411aa18fc3ba1a6a02c447b
BLAKE2b-256 f20b21452e7da8c50c59b50bff43408b52dfe0b526edce2056e50bb6732063b9

See more details on using hashes here.

File details

Details for the file django_gizmo-0.0.2-py2.7.egg.

File metadata

File hashes

Hashes for django_gizmo-0.0.2-py2.7.egg
Algorithm Hash digest
SHA256 3d54412ab9819d6eea4070761137fefec93859cc0afc2eb5be1754d6b37acd98
MD5 8a3e381012c5dfd919962188b71f7720
BLAKE2b-256 203c5614e72355453a83afa740bd7a74e29810fbb6f3aa7c4527a55ec0370378

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_gizmo-0.0.2-py2.6.egg
Algorithm Hash digest
SHA256 25f85712c6002186090664401021aebf3d26c1941b870691b73577970be3067b
MD5 6b7668789e43e417b36adbf0bea107f5
BLAKE2b-256 08d34ff17be3789d494cbd803fdf7e8adeac3b9f6e22feccb436a59c158fdaea

See more details on using hashes here.

Supported by

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