Hi Carlton,
On Mon, Aug 22, 2022 at 6:21 AM Carlton Gibson <carlton.gib...@gmail.com> wrote:
The current get_default() behaviour was only added to allow folks manually creating `Template("My String")` instances to continue to operate with multiple Django backends defined (#27359) — the initial assumption there was that anonymous backend usage wouldn't be supported, i.e. that folks would do `engines["django"]` to get a specific backend. Could you use that?
Yeah, that works! Thank you for the hint.
The docs mention this functionality with the wrong wording, which is why I was
not aware of this functionality:
Template engines are available in django.template.engines:
from django.template import engines
django_engine = engines['django']
template = django_engine.from_string("Hello {{ name }}!")
--
https://docs.djangoproject.com/en/4.0/topics/templates/#django.template.loader.engines
This is not accurate: `engines` ironically holds the template backends, not the
engines, and each engine can be retrieved by calling .engine (such as
engines['django'].engine).
In general, the docs are very inconsistent in this regard and use the terms "backend" and
"engine" pretty much interchangeably. The code is naturally more strict, but the iterable
holding the backends nevertheless is called `engines`.
If people feel this is a correct assessment, I can try improving on the wording.
Thanks,
Peter
--
https://desec.io/
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/5232c741-8410-1bcc-62d0-3ee942b25ea2%40desec.io.