Commits

Scott Walton committed de7273a

Check get_username() for compatibility with Django 1.5 user models

  • Participants
  • Parent commits 46104c6

Comments (0)

Files changed (1)

registration/models.py

 
         """
         salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
-        username = user.username
+        try:
+            # Django >= 1.5
+            username = user.get_username()
+        except AttributeError:
+            # Django < 1.5
+            username = user.username
         if isinstance(username, unicode):
             username = username.encode('utf-8')
         activation_key = hashlib.sha1(salt+username).hexdigest()