Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit f54efba

Browse files
author
Senthil Palanisami
committed
Custom User model compatibility
From the docs: "Since the User model can be swapped out, you should use this method instead of referencing the username attribute directly."
1 parent 121bf74 commit f54efba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework_jwt/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def jwt_payload_handler(user):
88
return {
99
'user_id': user.id,
1010
'email': user.email,
11-
'username': user.username,
11+
'username': user.get_username(),
1212
'exp': datetime.datetime.utcnow() + api_settings.JWT_EXPIRATION_DELTA
1313
}
1414

0 commit comments

Comments
 (0)