Model reversion

55 views
Skip to first unread message

Alireza Savand

unread,
May 9, 2012, 9:15:06 AM5/9/12
to django...@googlegroups.com
Hi
First of all i know there is a plugable app called django-reversion, leave it now!

I like to discus about some idea to implement a simple reversion app. i have couple of thoughts about it, all i need is just another people's ideas about it.

If i'm wrong correct me!
The model that used to keep history|changes, is a generic model and of course powered by ContentType [framework|app], and revision should be done in tracking the changes in git way, not svn-like which make a copy of the changed file.
And of course data should be saved in JSON format, thanks to simple json! ( using django signals to keep eyes on model changes )
Different between the models can be handled by difflib!
Okay yet theoretically is not a big implementation!
But the main point and important step is reverting, which i don't have clear idea about it!
And i know i probably missed couple of things there.

i like to know your [idea|suggestion|advice]!
Thanks!

francescortiz

unread,
May 9, 2012, 3:37:10 PM5/9/12
to django...@googlegroups.com
Json and difflib won't work well together, unless you make a diff per field, which will add overhead. Look at http://stackoverflow.com/questions/4599456/textually-diffing-json

Reverting is returning to a previous state. Just run all diffs from the first commit until you reach the desired state.

It would be great that it showed side by side the older an newer values of each field in a table view and let you choose what you want to revert. Maybe text fields on the left, values on the right and a copy button on each side.

Don't forget about foreign keys. A reversion might imply restoring a deleted item.

Alireza Savand

unread,
May 10, 2012, 2:19:51 AM5/10/12
to django...@googlegroups.com
Thanks for your reply and the link.

But what about binary items, i mean files. should we keep eyes on them, and if user delete them we should not delete them and just hide them?
Or reversion is just about text and text ?

And something else, reversion model shoulda trace the creator of the changes or no it shoulda just keep model's changes?

Alireza Savand

unread,
May 10, 2012, 7:20:23 AM5/10/12
to django...@googlegroups.com
Another thing is which library shoulda be used to generate diff and do path on versions?
there is some of them such as:
The google-diff-match-patch looks really well. and have good approach over difflib which is provided by python itself.
any advice about them ?

francescortiz

unread,
May 10, 2012, 10:37:14 AM5/10/12
to django...@googlegroups.com
Well, creation and deletion should be tracket. Also, binary items should be purged once versions are purged, not before.
Reply all
Reply to author
Forward
0 new messages