Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Quick and dirty test of a simple Django model versioning scheme
branch: master

Dirty Version

I threw this together as a proof of concept about how we can simplify our versioning scheme in the ASU Repository.

This is based on tuple versioning of a type 2 slowly changing dimension.

Versioning a model requires only that you subclass versions.models.Versionable. The model will have a custom default manager to provide access to current or historical versions.

If a versioned resource is related to another versioned resource (currently only tested for foreign key relationships) the versions.models.VersionedRelation class is provided as a surrogate for reverse attribute lookup as provided by Django. This ensures that you are dealing with the appropriate versions of the related resources. Hooking this up is a bit awkward, but this is just a POC.

Try it out!

Usage is described in detail in the unit tests. Everything should be set up to run the tests out of the box -- just clone the repo and run:

./ syncdb
./ test versions
Something went wrong with that request. Please try again.