On my app I am using django-reversion and django-reversion-compare apps extensions to controll object version.
When I update object outside admin I would like set_comment()
with just updated fields. How can I access to list of updated fields and set they as comment of that reversion?
I understand when I compare object version I see which fields was changed, but I want have preview in table history of changes.
I was trying do this by django-dirtyfields
, but it was return all fields.
Add objects:
with reversion.create_revision():
# create or update if exists
p = Product(reference='010101', name='new name')
p.save()
Model:
class Product(models.Model):
reference = models.CharField(max_length=8, unique=True, primary_key=True)
name = models.CharField(max_length=60, null=True)