aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/authtoken')
-rw-r--r--rest_framework/authtoken/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rest_framework/authtoken/models.py b/rest_framework/authtoken/models.py
index 7f5a75a3..52c45ad1 100644
--- a/rest_framework/authtoken/models.py
+++ b/rest_framework/authtoken/models.py
@@ -2,6 +2,7 @@ import uuid
import hmac
from hashlib import sha1
from rest_framework.compat import User
+from django.conf import settings
from django.db import models
@@ -13,6 +14,14 @@ class Token(models.Model):
user = models.OneToOneField(User, related_name='auth_token')
created = models.DateTimeField(auto_now_add=True)
+ class Meta:
+ # Work around for a bug in Django:
+ # https://code.djangoproject.com/ticket/19422
+ #
+ # Also see corresponding ticket:
+ # https://github.com/tomchristie/django-rest-framework/issues/705
+ abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS
+
def save(self, *args, **kwargs):
if not self.key:
self.key = self.generate_key()