Skip to content

Commit

Permalink
Merge pull request #3860 from linovia/bug/leave_token_abstract
Browse files Browse the repository at this point in the history
Restore the abstract on Token model when the app isn't declared
  • Loading branch information
xordoquy committed Jan 21, 2016
2 parents 06dd55a + 9e8ddb8 commit 98fc7ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rest_framework/authtoken/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ class Token(models.Model):
on_delete=models.CASCADE)
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()
Expand Down

0 comments on commit 98fc7ca

Please sign in to comment.