What I need: I want to get the details of the object from the database. I am using the get () function. The problem I have is that I enter the function, and one of the arguments is the field name as a string:
def delete_file_if_changed(id, change, form, model, field_name='image'): if change: if field_name in form.changed_data: old_image = model.objects.get(pk__exact=id)
Now - how can I do what old_image.field_name can get - how to do it?
source share