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

File details

Details for the file django-app-namespace-template-loader-0.1.tar.gz.

File metadata

File hashes

Hashes for django-app-namespace-template-loader-0.1.tar.gz
Algorithm Hash digest
SHA256 6a20c5f37c75ac014201c57ae5a5ede2d41b1abb9cc56f8b7668d6670dfc687d
MD5 462a2b2c42430979d86c88fc8c89501e
BLAKE2b-256 d93878db608fbf95ab2495bcdcd95a6b95cd739ccc7f4d85a93bbde1512f7529

See more details on using hashes here.

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