--
You received this message because you are subscribed to the Google Groups "django-reversion discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-reversi...@googlegroups.com.
To post to this group, send email to django-r...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-reversion.
For more options, visit https://groups.google.com/d/optout.
It's a tricky problem. Option 3 involves no duplication of data, so I guess that's the best. It also avoids a race condition in revision creation.
On Tue, 30 May 2017 at 13:24 <anupa...@gmail.com> wrote:
I spent a while searching for a good solution to this but couldnt figure an ideal way yet, so thought to post it here, before deciding on anything.--In the History of a model instance on the admin, I would ideally like to log what fields were edited along with their old and new values. Something like the following:
Edited:
Name (John -> Sarah)State (VA -> CA)This seems to have been discussed a few times on SO and perhaps also on this list. The available options seem to be the following:1) Fetch the existing model instance before saving the new model instance. Compare each field. Put the changed field in reversion.set_comment('(all changes here)'). Continue with saving the model instance.2) Save a copy of the old fields separately in model's __init__() and later in model's save(), compare the new fields with them to track what changed. Put the changed field in reversion.set_comment('(all changes here)'). Continue with saving the model instance. (This approach will save a DB lookup)3) Generate a diff as mentioned here and integrate with the Admin somehow (honestly, dont know what it'll take to do that as compared to the above approaches)Would be interesting to know if there is any other way to do the above/which ones of the above seems more intuitive. The last one seems to be utilising django-reversion more than other approaches, since it already has full revisions stored, so I am leaning more towards it, but eager to hear thoughts.Anupam
You received this message because you are subscribed to the Google Groups "django-reversion discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-reversion+unsubscribe@googlegroups.com.
To post to this group, send email to django-reversion@googlegroups.com.
Visit this group at https://groups.google.com/group/django-reversion.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "django-reversion discussion group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-reversion/_vzvnHsRBFI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-reversion+unsubscribe@googlegroups.com.
To post to this group, send email to django-reversion@googlegroups.com.
Visit this group at https://groups.google.com/group/django-reversion.
For more options, visit https://groups.google.com/d/optout.