Template loader allowing you to both extend and override a template at the same time.
Project description
Provides a template loader that allows you to load a template from a specific application. This allows you to both extend and override a template at the same time.
The default Django loaders require you to copy the entire template you want to override, even if you only want to override one small block.
Template usage example (extend and override the title block of Django admin base template):
$ cat my-project/templates/admin/base_site.html {% extends "admin:admin/base_site.html" %} {% block title %}{{ title }} - My Project{% endblock %}
Simply add this line into the TEMPLATE_LOADERS setting of your project to benefit this feature once the module installed.
TEMPLATE_LOADERS = [ 'app_namespace.Loader', ... # Others template loader ]
Based on: http://djangosnippets.org/snippets/1376/
Requires: Django >= 1.4
Tested with Python 2.6, 2.7, 3.2, 3.3.
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
File details
Details for the file django-app-namespace-template-loader-0.1.tar.gz
.
File metadata
- Download URL: django-app-namespace-template-loader-0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a20c5f37c75ac014201c57ae5a5ede2d41b1abb9cc56f8b7668d6670dfc687d |
|
MD5 | 462a2b2c42430979d86c88fc8c89501e |
|
BLAKE2b-256 | d93878db608fbf95ab2495bcdcd95a6b95cd739ccc7f4d85a93bbde1512f7529 |