django-templateloaderwithpriorities 1.0dev

A Django Template Loader with priorities

Django TemplateLoaderWithPriorities

A django template loader that allows you to control the order which the template dirs (filesystem directories or apps' template directories) are resolved in.

Useful when you want to override third party apps templates.

Installation and use

Get templateloaderwithpriorities from pypy or github:

$ pip install django-templateloaderwithpriorities

or:

$ pip install -e git+git://github.com/qubird/django-templateloaderwithpriorities#egg=templateloaderwithpriorities

Once installed, put the loader on top of settings.TEMPLATE_LOADERS:

TEMPLATE_LOADERS = ('templateloaderwithpriorities.Loader', ) + TEMPLATE_LOADERS

Be sure that it's the first item of TEMPLATE_LOADERS, else your priorities will be ignored.

Then add TEMPLATE_LOADER_PRIORITIES to your settings.py:

TEMPLATE_LOADER_PRIORITIES = [
    'my.app',
    '/path/to/my/custom/templates'
]

The loader searches for templates in the given order, looking for the templates directory if the item is an app, or the directory itself if the item is an absolute path.

First come, first served.

GNU General Public License (GPL)

Author

Vincenzo E. Antignano (@qubird)

Pip

django-templateloaderwithpriorities==1.0dev

Classifiers

  • Framework :: Django
  • Intended Audience :: Developers
  • Programming Language :: Python
  • License :: OSI Approved :: GNU General Public License (GPL)
File Type Python Version Uploaded On Downloads
django-templateloaderwithpriorities-1.0dev.tar.gz Source Dec. 28, 2011 3,623
Version Release Date
1.0dev Dec. 28, 2011
Date Package Version Action
Aug. 26, 2015, 12:28 a.m. django-templateloaderwithpriorities 1.0dev Release Created
Aug. 26, 2015, 12:28 a.m. django-templateloaderwithpriorities Package Created