Skip to main content

Template loader allowing you to both extend and override a template at the same time.

Project description

Build Status - develop branch Coverage of the code

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

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page