django-apptemplates is a Django template loader that allows you to load a template from a specific application. By this you can 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.
Based on: http://djangosnippets.org/snippets/1376/
django-apptemplates is tested against the officially supported combinations of Python and Django, since Django 1.4 (Django 1.4 to 3.0 on Python 2.7, and 3.4 to 3.8).
Installation, Setup and UseThis package is available from PyPI. To install it simply execute:
$ pip install django-apptemplatesSettings (for Django 1.8+)
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'OPTIONS': { 'loaders': [ 'apptemplates.Loader', 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], }, }, ]Settings (for Django < 1.8)
TEMPLATE_LOADERS = ( 'apptemplates.Loader', 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )
Template usage example (extend and override Django admin base template):
{% extends "admin:admin/base.html" %}
The part before the colon (:
) is called the Django app namespace.
ImportError
for Django 1.8 (broken in release 1.1)clean
and test
commands to setup.py
django.template.Origin
in computation of template location for Django 1.9 compatibility. -- Thanks, Gilles Crettenand!Skipped to fix conflicting versioning in setup.py and the PyPI package
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4