From f5393ffbe0678de36de239156797bf1a24877318 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Mon, 14 Oct 2013 20:33:10 +0200 Subject: [PATCH] python 3 compatible token class. --- rest_framework/authtoken/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rest_framework/authtoken/models.py b/rest_framework/authtoken/models.py index 7601f5b79..2b07866b9 100644 --- a/rest_framework/authtoken/models.py +++ b/rest_framework/authtoken/models.py @@ -4,8 +4,10 @@ from hashlib import sha1 from rest_framework.compat import AUTH_USER_MODEL from django.conf import settings from django.db import models +from django.utils.encoding import python_2_unicode_compatible +@python_2_unicode_compatible class Token(models.Model): """ The default authorization token model. @@ -31,5 +33,5 @@ class Token(models.Model): unique = uuid.uuid4() return hmac.new(unique.bytes, digestmod=sha1).hexdigest() - def __unicode__(self): + def __str__(self): return self.key