class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
exclude = (
'password', 'last_login', 'is_superuser', 'email',
'gender', 'verify_code', 'created_on', 'is_active',
'is_staff', 'groups', 'user_permissions', 'courses'
)
class ResponseCommentSerializer(serializers.ModelSerializer):
user_response = UserSerializer()
class Meta:
model = ResponseComment
fields = '__all__'
depth = 1
class CommentSerializer(serializers.ModelSerializer):
user = UserSerializer()
response = ResponseCommentSerializer(many=True, read_only=True)
class Meta:
model = Comment
fields = '__all__'
depth = 2