Coverage for api/serializers.py: 60%
8 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-08 12:47 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-08 12:47 -0600
1from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
3from apps.users.serializers import UserPolymorphicSerializer
6class UserToken(TokenObtainPairSerializer):
7 def validate(self, attrs):
8 data = super().validate(attrs)
9 user_serializer = UserPolymorphicSerializer(self.user, context={"request": self.context.get("request")})
11 data["user"] = user_serializer.data
13 return data