aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken/models.py
diff options
context:
space:
mode:
authorTom Christie2014-12-12 15:37:43 +0000
committerTom Christie2014-12-12 15:37:43 +0000
commitbaaa356489dd51d7c68161db40e99cd59b1124c3 (patch)
tree23dc5c4cbe1065580ff88ddd1bfa6dcda956ac68 /rest_framework/authtoken/models.py
parent5e6052811716a494e995a84c497579867ee6acaa (diff)
parentfd473aa905337908b41c9a1087967a19f0558f89 (diff)
downloaddjango-rest-framework-baaa356489dd51d7c68161db40e99cd59b1124c3.tar.bz2
Merge master
Diffstat (limited to 'rest_framework/authtoken/models.py')
-rw-r--r--rest_framework/authtoken/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/authtoken/models.py b/rest_framework/authtoken/models.py
index db21d44c..a1a9315f 100644
--- a/rest_framework/authtoken/models.py
+++ b/rest_framework/authtoken/models.py
@@ -1,7 +1,9 @@
import binascii
import os
+
from django.conf import settings
from django.db import models
+from django.utils.encoding import python_2_unicode_compatible
# Prior to Django 1.5, the AUTH_USER_MODEL setting does not exist.
@@ -11,6 +13,7 @@ from django.db import models
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
+@python_2_unicode_compatible
class Token(models.Model):
"""
The default authorization token model.
@@ -35,5 +38,5 @@ class Token(models.Model):
def generate_key(self):
return binascii.hexlify(os.urandom(20)).decode()
- def __unicode__(self):
+ def __str__(self):
return self.key