mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Merge pull request #3860 from linovia/bug/leave_token_abstract
Restore the abstract on Token model when the app isn't declared
This commit is contained in:
commit
98fc7caad8
|
@ -22,6 +22,14 @@ class Token(models.Model):
|
||||||
on_delete=models.CASCADE)
|
on_delete=models.CASCADE)
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
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):
|
def save(self, *args, **kwargs):
|
||||||
if not self.key:
|
if not self.key:
|
||||||
self.key = self.generate_key()
|
self.key = self.generate_key()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user