Exposed Engine in the django.template namespace.
It's the main entrypoint to the refactored template system.
This commit is contained in:
parent
f7c287fca9
commit
118592663d
|
@ -41,12 +41,14 @@ Shared:
|
||||||
|
|
||||||
### Multiple Template Engines
|
### Multiple Template Engines
|
||||||
|
|
||||||
|
from .engine import Engine
|
||||||
|
|
||||||
from .utils import EngineHandler
|
from .utils import EngineHandler
|
||||||
|
|
||||||
|
|
||||||
engines = EngineHandler()
|
engines = EngineHandler()
|
||||||
|
|
||||||
__all__ = ('engines',)
|
__all__ = ('Engine', 'engines')
|
||||||
|
|
||||||
|
|
||||||
### Django Template Language
|
### Django Template Language
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.utils.deprecation import RemovedInDjango20Warning
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
|
||||||
from . import engines
|
|
||||||
from .base import Context, Lexer, Parser, Template, TemplateDoesNotExist
|
from .base import Context, Lexer, Parser, Template, TemplateDoesNotExist
|
||||||
from .context import _builtin_context_processors
|
from .context import _builtin_context_processors
|
||||||
|
|
||||||
|
@ -68,8 +67,10 @@ class Engine(object):
|
||||||
>>> template.render(context)
|
>>> template.render(context)
|
||||||
'Hello world!'
|
'Hello world!'
|
||||||
"""
|
"""
|
||||||
# Since DjangoTemplates is a wrapper around this Engine class, a local
|
# Since Engine is imported in django.template and since
|
||||||
# import is mandatory to avoid an import loop.
|
# DjangoTemplates is a wrapper around this Engine class,
|
||||||
|
# local imports are required to avoid import loops.
|
||||||
|
from django.template import engines
|
||||||
from django.template.backends.django import DjangoTemplates
|
from django.template.backends.django import DjangoTemplates
|
||||||
django_engines = [engine for engine in engines.all()
|
django_engines = [engine for engine in engines.all()
|
||||||
if isinstance(engine, DjangoTemplates)]
|
if isinstance(engine, DjangoTemplates)]
|
||||||
|
|
Loading…
Reference in New Issue