Question

What I'm trying to do is get a record of all the fields that may have changed after a object has changed. I know there are many ways to tell if an object has changed as well as some other django packages like django-revisions, django-reversion, and django-simple-history but I want to be able to have a report that shows all of the field that have changed, not just one. I also what to show what the field was before it was changed so I can have a complete audit on the object.

I was thinking of adding a json field with django-jsonfield but felt kind of wrong to do it like this. As if it was a hack or dirty work around. Is there a more traditional or simpler way to do this.

Was it helpful?

Solution

You might take a look at django-dirtyfields. When an object is updated, you could get a list of all of the fields that are dirty and generate the report you need. It won't do this automatically, but it would get you the fields that have been changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top