etianen/django-reversion — pull request #206 by uruz (2013-01-05 03:24:33+00:00)
Title: Changed code which handles swapped out auth.user model to prevent circular import

At the previous approach you may get circular import error, if your custom User model is defined at the same file, at which you call `reversion.register()`. That is because register imports `reversion.models`, and those call `get_user_model()`, and this function import `models.py` of the application, which contains register call.

This change is backwards-compatible with django < 1.5, because before then there were no `settings.AUTH_USER_MODEL`, so UserModel becomes just 'auth.User', and using string in format "appname.ModelName" in ForeignKey is OK even for django 1.3: https://docs.djangoproject.com/en/1.3/ref/models/fields/#foreignkey