mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 00:56:34 +03:00
Allow using custom UserDetailsSerializer with JWTSerializer
This commit is contained in:
parent
70d03e3e9b
commit
a907efc06b
|
@ -135,7 +135,16 @@ class JWTSerializer(serializers.Serializer):
|
|||
Serializer for JWT authentication.
|
||||
"""
|
||||
token = serializers.CharField()
|
||||
user = UserDetailsSerializer()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
Need to add `user` field dynamically, to allow using
|
||||
custom UserDetailsSerializer
|
||||
"""
|
||||
from app_settings import UserDetailsSerializer
|
||||
|
||||
super(JWTSerializer, self).__init__(*args, **kwargs)
|
||||
self.fields['user'] = UserDetailsSerializer()
|
||||
|
||||
|
||||
class PasswordResetSerializer(serializers.Serializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user