2
Use the getattr()
function:
colObj = College.objects.get(id=1)
name = "collegeName"
colName = getattr(colObj, name)
Source:stackexchange.com
2
Use the getattr()
function:
colObj = College.objects.get(id=1)
name = "collegeName"
colName = getattr(colObj, name)