[patch] cooler version of django.template.loaders.app_directories
|Reported by:||Owned by:||Adrian Holovaty|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The provided app_directories template loader is a bit uncool: To separate applications, you need to put your templates in subdirectories like this:
... so that you can load them as "app1/index" respective "app2/index"
I changed this a bit and created a new template loader that works like this:
If you request to load template "app1/index", it goes through all applications with label "app1" that have a "templates" subdirectory. It strips the application label off and tries to find the rest in the templates subdirectory. As a result, "app1/index" finds ".../app1/templats/index.html".
I suggest to put this in the contributions as django.contrib.template_loader.virtual_app_directories, but wouldn't mind a better name ...