﻿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
1495	template variable dictionary lookups use arguments as strings not as variable names	gt-django@…	Adrian Holovaty	"I was looking at trying to do something in a template like:

   {% for obj in object_list %}
      {{ ratings_dict.obj }}

But it didn't work.   Testing shows that my problem is that the template system doesn't do a dictionary lookup of the VARIABLE obj, but rather of the string ""obj"".

The docs show an example:

>>> from django.core.template import Context, Template
>>> t = Template(""My name is {{ person.first_name }}."")
>>> d = {""person"": {""first_name"": ""Joe"", ""last_name"": ""Johnson""}}
>>> t.render(Context(d))
""My name is Joe.""


Perhaps you might want to first attempt to resolve the variable ""first_name"" (as in the above example) and then if it doesn't resolve, then treat it as a character string.

Or, since it would be easy to explicitly specify it AS a character string (e.g. {{ person.""first_name"" }} for those times when you want the string first_name instead of the variable first_name to be used, that might be an alternative implementation.

I don't know if this is a ""defect"" or an enhancement, but I'll opt for ""enhancement"" and let the developers decide.

Thank you
"	enhancement	closed	Template system		normal	wontfix			Unreviewed	0	0	0	0	0	0
