1👍
✅
Aha! What I wanted here was getattr, which does exactly this, and is a Python affair rather than a Django one.
This page explained it helpfully: http://effbot.org/zone/python-getattr.htm – essentially, these lines are equivalent:
value = obj.attribute;
and
value = getattr(obj, "attribute")
Source:stackexchange.com