diff options
| author | Tom Christie | 2013-03-08 23:00:23 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-03-08 23:00:23 +0000 |
| commit | 5e993f39294da5e8650c7ac21aeb3da02012b775 (patch) | |
| tree | d95dfd6c09b6d4b8dfc869f103cb59c65488dcac /rest_framework/authtoken | |
| parent | 2596c12a21003d230beb101aa93ddf83a1995305 (diff) | |
| parent | 6c1fcc855a2d05732113ce260b8660a414e1961e (diff) | |
| download | django-rest-framework-5e993f39294da5e8650c7ac21aeb3da02012b775.tar.bz2 | |
Merge
Diffstat (limited to 'rest_framework/authtoken')
| -rw-r--r-- | rest_framework/authtoken/models.py | 9 |
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() |
