For a view that updates a model, I’d like to do something like this:
for field in ('name', 'parent', 'notes'):
if request.POST[field]:
myModel[field] = request.POST.get(field, '')
However, model’s fields are accessed as properties (myModel.field), not dictionary items, and as far as I can tell there aren’t get/set methods in Django models. Is there another way I can update these properties iteratively?
setattr()