Commits

mszamot committed bb6820a

Django 1.7 compatible

  • Participants
  • Parent commits 315ef4b

Comments (0)

Files changed (1)

File registration/models.py

 except ImportError:
     from django.contrib.auth.models import User
 else:
-    User = get_user_model()
+    User = None
 from django.db import models
 from django.db import transaction
 from django.template.loader import render_to_string
 from django.utils.translation import ugettext_lazy as _
 
 try:
-    from django.contrib.auth import get_user_model
-    User = get_user_model()
-except ImportError:
-    from django.contrib.auth.models import User
-
-try:
     from django.utils.timezone import now as datetime_now
 except ImportError:
     datetime_now = datetime.datetime.now
         user. To disable this, pass ``send_email=False``.
         
         """
+        global User
+        if User is None:
+            User = get_user_model()
         new_user = User.objects.create_user(username, email, password)
         new_user.is_active = False
         new_user.save()
         be deleted.
         
         """
+        global User
+        if User is None:
+            User = get_user_model()
         for profile in self.all():
             try:
                 if profile.activation_key_expired():
     """
     ACTIVATED = u"ALREADY_ACTIVATED"
     
-    user = models.ForeignKey(User, unique=True, verbose_name=_('user'))
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, unique=True, verbose_name=_('user'))
     activation_key = models.CharField(_('activation key'), max_length=40)
     
     objects = RegistrationManager()