class ActionSerializer(serializers.ModelSerializer): user = UserSerializer(many=False) class Meta: model = Action fields = ['pk', 'name', 'user', 'content_type', 'object_pk', 'date', 'app_label', 'model_name', 'object_str']
def get_user(self, obj): user = self.context['request'].user from apps.users.api.v1 import UserSerializer serializer = UserSerializer(user) serializer.context['request'] = self.context['request'] return serializer.data