summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorPreston Timmons <prestontimmons@gmail.com>2014-11-16 17:13:40 -0600
committerCarl Meyer <carl@oddbird.net>2014-11-18 21:17:17 -0700
commit536795f79a956febc06a7fa5c86e3a395f2c94eb (patch)
tree100bb2221ef47aed67cb2204b1a3b6eae30268b4 /docs/ref
parent08fbbaa45b7b3f3a811b33c6bdf4222acd21d0b0 (diff)
Fixed #23849 -- Documented the locmem.Loader class.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/templates/api.txt22
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 6a3f160af3..834e57e006 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -735,7 +735,7 @@ sources.
Some of these other loaders are disabled by default, but you can activate them
by editing your :setting:`TEMPLATE_LOADERS` setting. :setting:`TEMPLATE_LOADERS`
-should be a tuple of strings, where each string represents a template loader
+should be a tuple of strings or tuples, where each represents a template loader
class. Here are the template loaders that come with Django:
.. currentmodule:: django.template.loaders
@@ -778,7 +778,7 @@ class. Here are the template loaders that come with Django:
``django.contrib.admin`` in :setting:`INSTALLED_APPS`, otherwise
``django.contrib.admin``’s will be loaded first and yours will be ignored.
- Note that the loader performs an optimization when it is first imported:
+ Note that the loader performs an optimization when it first runs:
it caches a list of which :setting:`INSTALLED_APPS` packages have a
``templates`` subdirectory.
@@ -828,6 +828,24 @@ class. Here are the template loaders that come with Django:
This loader is disabled by default.
+``django.template.loaders.locmem.Loader``
+
+.. versionadded:: 1.8
+
+.. class:: locmem.Loader
+
+ Loads templates from a Python dictionary. This is useful for testing.
+
+ This loader takes a dictionary of templates as its first argument::
+
+ TEMPLATE_LOADERS = (
+ ('django.template.loaders.locmem.Loader', {
+ 'index.html': 'content here',
+ }),
+ )
+
+ This loader is disabled by default.
+
Django uses the template loaders in order according to the
:setting:`TEMPLATE_LOADERS` setting. It uses each loader until a loader finds a
match.