django-gizmo 0.0.4

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...
    

Pip

django-gizmo==0.0.4
File Type Python Version Uploaded On Downloads
django_gizmo-0.0.4-py2.4.egg Egg 2.4 July 31, 2012 1,546
django-gizmo-0.0.4.tar.gz Source July 31, 2012 2,455
Version Release Date
0.0.4 July 31, 2012
0.0.3 May 8, 2012
0.0.2 Aug. 11, 2011
0.0.1 Aug. 3, 2010
Date Package Version Action
Nov. 4, 2014, 1:16 p.m. django-gizmo 0.0.2 Release Created
Nov. 4, 2014, 1:16 p.m. django-gizmo 0.0.3 Release Created
Nov. 4, 2014, 1:16 p.m. django-gizmo 0.0.1 Release Created
Nov. 4, 2014, 1:16 p.m. django-gizmo 0.0.4 Release Created
Nov. 4, 2014, 1:16 p.m. django-gizmo Package Created