mirror of https://github.com/django/django.git
Fixed #23849 -- Documented the locmem.Loader class.
This commit is contained in:
parent
08fbbaa45b
commit
536795f79a
|
@ -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.
|
||||
|
|
|
@ -414,6 +414,9 @@ Templates
|
|||
its query string as part of the URL (the URL in e.g. ``'djangoproject.com!``
|
||||
is ``djangoproject.com``)
|
||||
|
||||
* Added a :class:`locmem.Loader <django.template.loaders.locmem.Loader>`
|
||||
class that loads Django templates from a Python dictionary.
|
||||
|
||||
Requests and Responses
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Reference in New Issue