📅  最后修改于: 2022-03-11 14:46:10.236000             🧑  作者: Mango
class UserProfileSerializer(serializers.ModelSerializer):
class Meta:
model = UserProfile
fields = ('id', 'user', 'emp_id', 'department')
class UserPairSerializer(serializers.ModelSerializer):
profile = UserProfileSerializer(read_only=True, source='userprofile')
class Meta:
model = User
fields = ('id', 'email', 'is_active', 'profile')