Commits

Alexey Boriskin committed ef85dbe

Adapt django-versioning for the swappable django user model

  • Participants
  • Parent commits 5e42fbe

Comments (0)

Files changed (1)

versioning/models.py

 from datetime import datetime
 
 from django.db import models, IntegrityError
-from django.contrib.auth.models import User
 from django.contrib.contenttypes import generic
 from django.contrib.contenttypes.models import ContentType
 from django.utils.encoding import force_unicode
 from django.utils.translation import ugettext_lazy as _
+from django.conf import settings
 
 from . import _registry
 from .managers import RevisionManager
 except NameError:
     pass
 
+UserModel = getattr(settings, 'AUTH_USER_MODEL', 'auth.User') 
 
 class Revision(models.Model):
     """
     comment = models.CharField(_("Editor comment"), max_length=255,
                                blank=True)
 
-    editor = models.ForeignKey(User, verbose_name=_('Editor'),
+    editor = models.ForeignKey(UserModel, verbose_name=_('Editor'),
                                blank=True, null=True,
                                on_delete=models.SET_NULL)
     editor_ip = models.IPAddressField(_("IP Address of the Editor"),