Exemple #1
0
    def get_template_by_show_version(self, request, *args, **kwargs):
        req_data = copy.deepcopy(self.kwargs)
        req_data["project_id"] = request.project.project_id

        serializer = GetShowVersionSLZ(data=req_data)
        serializer.is_valid(raise_exception=True)
        validated_data = serializer.validated_data

        self.can_view_template(request, validated_data["template"])
        serializer = serializers.GetFormTemplateSLZ(validated_data)

        return Response(serializer.data)
Exemple #2
0
    def get_template_by_show_version(self, request, project_id, template_id, show_version_id):
        serializer = GetShowVersionSLZ(data=self.kwargs)
        serializer.is_valid(raise_exception=True)
        validated_data = serializer.validated_data

        template = validated_data["template"]
        self.can_view_template(request, template)

        with_file_content = request.query_params.get("with_file_content")
        with_file_content = False if with_file_content == "false" else True

        serializer = serializers.GetTemplateFilesSLZ(validated_data, context={"with_file_content": with_file_content})
        return Response(serializer.data)