]> git.parisson.com Git - django_quiz.git/commitdiff
Use settings.AUTH_USER_MODEL rather than auth.User.
authorJohn Gill <swfiua@gmail.com>
Mon, 2 Feb 2015 19:39:14 +0000 (15:39 -0400)
committerJohn Gill <swfiua@gmail.com>
Mon, 2 Feb 2015 19:39:14 +0000 (15:39 -0400)
This is needed when using djang-allauth, since it replaces
auth.User with its own class.

quiz/models.py

index 64913d2053da4cb64e086e9ac5d0453cb4f588ba..8a8c8de24db1f8d0a2ebdbb466c8f64af0e2b130 100644 (file)
@@ -8,6 +8,7 @@ from django.core.validators import MaxValueValidator
 from django.utils.translation import ugettext as _
 from django.utils.timezone import now
 from django.utils.encoding import python_2_unicode_compatible
+from django.conf import settings
 
 from model_utils.managers import InheritanceManager
 
@@ -188,7 +189,7 @@ class Progress(models.Model):
     Data stored in csv using the format:
         category, score, possible, category, score, possible, ...
     """
-    user = models.OneToOneField("auth.User", verbose_name=_("User"))
+    user = models.OneToOneField(settings.AUTH_USER_MODEL, verbose_name=_("User"))
 
     score = models.CommaSeparatedIntegerField(max_length=1024,
                                               verbose_name=_("Score"))
@@ -361,7 +362,7 @@ class Sitting(models.Model):
     with the answer the user gave.
     """
 
-    user = models.ForeignKey('auth.User', verbose_name=_("User"))
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("User"))
 
     quiz = models.ForeignKey(Quiz, verbose_name=_("Quiz"))