Short after posting how to get django-rcsfield running,
Marty Alchin posted to mention AuditTrail, and ask if I could see any compelling reasons to use something like django-rcsfield instead 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).
Last night I set up an app I am working on to use 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 the code at the bottom of the AuditTrail wiki entry into a file named
audit.py, somewhere in your Python path.
audit.py in your
from django.db import models
Add an AuditTrail field to your model definition.
title = models.CharField(max_length=200)
text = models.TextField()
history = audit.AuditTrail()
Sync your database.
>>> from models import MyModel
>>> MyModel.create(title="hi",text="some value")
>>> a = MyModel.objects.all()
>>> a.text = "some other value"
"some other value"
Although I really appreciate the hard work that has gone into
django-rcsfield, I think that AuditTrail is 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
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.