﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30205	New built-in tag to disable invoking callable variables during template variable resolution	Alex Epshteyn	nobody	"To improve upon the sub-optimal workaround introduced by #15791, I propose the following //non-breaking change//:

== Proposal for new built-in tag `callables [on|off]`
Introduce a new built-in tag similar to [https://django.readthedocs.io/en/stable/ref/templates/builtins.html#autoescape autoescape], that would allow disabling the //implicit invocation// of callable variables in a particular template block.  For example:

{{{#!django 
{% callables off %}
  <div>The class name is {{ foo.bar|type_name }}</div>
{% endcallables %}
}}}

Any variable resolutions performed inside this block would not implicitly invoke a callable during variable resolution unless the previous ""bit"" in the ""lookups"" path for this variable was an //instance// and the current ""bit"" is a //method// defined for the instance (see [https://github.com/django/django/blob/21ff23bfeb4014bceaa3df27677fb68409c0634d/django/template/base.py#L851 django.template.base.Variable._resolve_lookup]).

My justification for this feature request is detailed in #30197 (specifically, [https://code.djangoproject.com/ticket/30197#comment:5 this comment]).

The introduction of this new `callables [on|off]` tag would be a **non-breaking** way to:

1. solve the frequently-reported problems described in #30197, #15791, #29382, and #29306
2. adhere to the fundamental [https://django.readthedocs.io/en/stable/misc/design-philosophies.html Django design philosophies] of //[https://django.readthedocs.io/en/stable/misc/design-philosophies.html#loose-coupling ""Loose coupling""]// (by moving template-specific concerns from the application layer to the template layer), //[https://django.readthedocs.io/en/stable/misc/design-philosophies.html#less-code ""Less code""]//, and //[https://django.readthedocs.io/en/stable/misc/design-philosophies.html#explicit-is-better-than-implicit ""Explicit is better than implicit""].
"	New feature	new	Template system	dev	Normal		template, template variable, variable resolution, template tag		Someday/Maybe	0	0	0	0	0	0
