Skip to content

Instantly share code, notes, and snippets.

View akbarahmed's full-sized avatar

Akbar Ahmed akbarahmed

View GitHub Profile
@hidde-jan
hidde-jan / namespaced_app_directories.py
Created March 15, 2011 21:52
Django template loader that allows for `namespaced` loading of templates.
"""
Wrapper for loading templates from "templates" directories in INSTALLED_APPS
packages, prefixed by the appname for namespacing.
This loader finds `appname/templates/index.html` when looking for something
of the form `appname/index.html`.
"""
from django.template import TemplateDoesNotExist
from django.template.loaders.app_directories import app_template_dirs, Loader as BaseAppLoader