Consider my model (MODEL
) has field has attribute NAME
.
I want to reference to that model attribute using string.
eg. var = Model.objects.get( pk=1 )
var.str('NAME') = value
while trying with string it's giving me error : can't assign to function call
P.S.: I know for finding a value of attribute from string I can use getattr()
but since I want to assign value, this method isn't helpful.