Skip to main content

Build status Code health Python versions Software license

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/

Version Support

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 Use

This package is available from PyPI. To install it simply execute:

$ pip install django-apptemplates

Settings (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',
)

How to Use in Templates

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.

Alternatives

Authors and Maintainers

Change Log

(unreleased)

  • Drop support for Django 1.7 (ImportError)

  • Drop support for Python 2.6, 3.2, 3.3 (not available on Travis CI)

1.4

  • Fix Origin missing loader and template_name attrs – Thanks Brendan Roy, @bmon, and Matthew Somerville, @dracos!

  • Also test against Django 2.0

1.3

  • Add template loader to returned Origins – Thanks J.J., @jdotjdot!

  • Also test against Python 3.6 – Thanks Justin Walgran, @jwalgran!

1.2

  • Reestablish support for Django 1.4 through 1.8 (broken since version 1.1)

  • Add tests for template rendering

  • Drop support for Django 1.3 (which cannot be confirmed by tests)

  • Drop support for Python 2.4 and 2.5 (which cannot be tested anymore)

1.1.1

  • Fix ImportError for Django 1.8 (broken in release 1.1)

  • Add integration tests (test import of package across supported versions)

  • Add clean and test commands to setup.py

1.1

  • Use django.template.Origin in computation of template location for Django 1.9 compatibility. – Thanks, Gilles Crettenand!

1.0

  • Remove Django 1.9 deprecation warning of imports

  • Update README with instructions for Django 1.8+

0.2

Skipped to fix conflicting versioning in setup.py and the PyPI package

0.0.1

  • Released as originally published on djangosnippets

Release files for django-apptemplates 1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-apptemplates 1.5
File Size Uploaded
django-apptemplates-1.5.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-apptemplates 1.5
File Interpreter ABI Platform
django_apptemplates-1.5-py2-none-any.whl Python 2 none any Details

Total release size: 13.6 kB

Release files / django-apptemplates-1.5.tar.gz

Download URL django-apptemplates-1.5.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2c46afd3d90827c1d821f137d59e430cb203649aa275b9c2763c871d7545d3f
BLAKE2b-256 checksum
How to use checksums
b409c1ba396458b478dd0266f92595e6bf939684097c25b5ceea87a103bc7c40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Release files / django_apptemplates-1.5-py2-none-any.whl

Download URL django_apptemplates-1.5-py2-none-any.whl
Size 8.4 kB
Tags Python 2
SHA-256 checksum
How to use checksums
5631affc850a41f31fbc723473988a341d0260fe09d3c268d31633405c347f36
BLAKE2b-256 checksum
How to use checksums
e05206d264e06bef7df745ac772a90e598360b02548337ca43338e01ba5a04bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.5 This release

2 release files

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page