From 19c25583faccb2081fcadcbef59dcd350799ca40 Mon Sep 17 00:00:00 2001 From: "Breeze.kay" Date: Sun, 10 May 2015 22:23:10 +0800 Subject: [PATCH] set user's backend when use TokenAuthentication --- rest_framework/authentication.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index f0702286c..806133bcd 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -175,6 +175,8 @@ class TokenAuthentication(BaseAuthentication): if not token.user.is_active: raise exceptions.AuthenticationFailed(_('User inactive or deleted.')) + token.user.backend = "{0}.{1}".format(self.__class__.__module__, self.__class__.__name__) + return (token.user, token) def authenticate_header(self, request):