From 1ab782a430afe479535ee5bded81806dee189b69 Mon Sep 17 00:00:00 2001 From: dpanesso Date: Wed, 3 Sep 2014 23:38:03 -0500 Subject: [PATCH] Using user.get_username() instead of user.username. This solves an error when using a auth model that does not have a username field. --- rest_framework/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 5721a869e..f3fec05ec 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -344,7 +344,7 @@ class OAuth2Authentication(BaseAuthentication): user = token.user if not user.is_active: - msg = 'User inactive or deleted: %s' % user.username + msg = 'User inactive or deleted: %s' % user.get_username() raise exceptions.AuthenticationFailed(msg) return (user, token)