mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Moved all template loaders under django.template.loaders.
Reformatted the code of base.Loader according to modern standards. Turned the test template loader into a regular locmem.Loader -- but didn't document it. Added a normal deprecation path for BaseLoader which is a public API. Added an accelerated deprecation path for TestTemplateLoader which is a private API.
This commit is contained in:
parent
cffa559082
commit
2577ae6a08
12 changed files with 125 additions and 64 deletions
|
@ -967,11 +967,16 @@ with the Django loading and rendering system!
|
|||
|
||||
The next step is to write a ``Loader`` class that returns instances of our custom
|
||||
template class instead of the default :class:`~django.template.Template`. Custom ``Loader``
|
||||
classes should inherit from ``django.template.loader.BaseLoader`` and override
|
||||
classes should inherit from ``django.template.loaders.base.Loader`` and override
|
||||
the ``load_template_source()`` method, which takes a ``template_name`` argument,
|
||||
loads the template from disk (or elsewhere), and returns a tuple:
|
||||
``(template_string, template_origin)``.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
``django.template.loaders.base.Loader`` used to be defined at
|
||||
``django.template.loader.BaseLoader``.
|
||||
|
||||
The ``load_template()`` method of the ``Loader`` class retrieves the template
|
||||
string by calling ``load_template_source()``, instantiates a ``Template`` from
|
||||
the template source, and returns a tuple: ``(template, template_origin)``. Since
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue