diff options
| author | Tom Christie | 2014-12-05 13:14:14 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-05 13:14:14 +0000 |
| commit | 65d6cba75f9db0995020f01e9144b6660feb47d6 (patch) | |
| tree | 1212187336ad9f887a4c69dc805506d49f42b86e /rest_framework/authtoken/models.py | |
| parent | 9fb1b396db751234a531dabacb6758ac2645776c (diff) | |
| parent | d9930181ee157f51e2fcea33a3af5ea397647324 (diff) | |
| download | django-rest-framework-65d6cba75f9db0995020f01e9144b6660feb47d6.tar.bz2 | |
Merge pull request #2200 from maryokhin/master
Clean up compat code
Diffstat (limited to 'rest_framework/authtoken/models.py')
| -rw-r--r-- | rest_framework/authtoken/models.py | 5 |
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 |
