Short afterposting how to get django-rcsfield running,Marty Alchinposted to mentionAuditTrail, and ask if I could see any compelling reasons to use something likedjango-rcsfieldinstead of AuditTrail.
If you look at the two, they perform very similar services:
django-rcsfield uses a variety of version control systems (Git, Bazaar, Subversion) to maintain a complete version history of a textfield.
AuditTrail uses the database to maintain a complete version history of a model (although it doesn't necessarily play well with relations).
昨晚我建立了一个应用程序正在使用django-rcsfield, and it took a bit of sleuthing to understand. On the other hand, just now I was able to replace django-rcsfield with AuditTrail in about five minutes. Where rcsfield was opening up weird cross-platform issues related to Git, AuditTrail just worked. Where rcsfield was causing my small vps to lag horribly--again--AuditTrail just worked.
I can imagine some specific situations where having the full power of merging, cloning, branching, etc, would be a real asset, but I suspect such apps are a small minority of all the applications that benefit from some degree of versioning. For those not in that small bucket, AuditTrail seems like the best existing solution.
Setting AuditTrail up was a few short steps:
Paste thecode at the bottom of the AuditTrail wiki entryinto a file named
audit.py, somewhere in your Python path.
Add an AuditTrail field to your model definition.
Sync your database.
>>>frommodelsimportMyModel>>>MyModel.create(title="hi",text="some value")>>>a=MyModel.objects.all()>>>a.text="some other value">>>a.save()>>>a.history.count()2>>>a.history.all().text"some other value">>>a.history.all().text"some value"
Although I really appreciate the hard work that has gone intodjango-rcsfield, I think thatAuditTrailis simply an easier approach to versioning data at this point in time. I do think there is room in the world for both of these approaches, and that some apps will benefit more from using django-rcsfield than AuditTrail, but I'd recommend starting with AuditTrail and only transitioning over if and when circumstances demand it.
Hopefully both of these projects will continue to improve, but for the time being AuditTrail is the way to go unless you need more advanced VCS functionality like merging, pushing, pulling or cloning.