Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Restore the abstract on Token model when the app isn't declared
The fact that we don't import Token from authentication doesn't invalidate
the need for the model to be abstract whenever the authtoken isn't listed
in the INSTALLED_APPS.
  • Loading branch information
xordoquy committed Jan 21, 2016
commit 9e8ddb88fcc26e85202c37fc1b2aca80ef82c17a
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