From 1004801fd284a178d0f18fe6ab5fecc09d8923df Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Thu, 19 Dec 2024 18:08:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E6=95=B0=E6=8D=AEjson?= =?UTF-8?q?=E5=8C=96=20#7626?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/contrib/template_market/viewsets.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gcloud/contrib/template_market/viewsets.py b/gcloud/contrib/template_market/viewsets.py index 156028be6..38436c668 100644 --- a/gcloud/contrib/template_market/viewsets.py +++ b/gcloud/contrib/template_market/viewsets.py @@ -10,7 +10,6 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ -import json import logging from rest_framework import viewsets @@ -65,7 +64,7 @@ class TemplateSceneViewSet(viewsets.ViewSet): def _build_template_data(self, serializer, **kwargs): templates = TaskTemplate.objects.filter(id__in=serializer.validated_data["template_ids"], is_deleted=False) template_info = [{"id": template.id, "name": template.name} for template in templates] - data = {"source_system": settings.APP_CODE, "templates": json.dumps(template_info), **serializer.validated_data} + data = {"source_system": settings.APP_CODE, "templates": template_info, **serializer.validated_data} market_record_id = kwargs.get("market_record_id") if market_record_id: data["id"] = market_record_id @@ -186,9 +185,7 @@ def partial_update(self, request, *args, **kwargs): detail_response = self._handle_response(existing_records, "Failed to get details") if detail_response: return detail_response - existing_market_template_ids = set( - [template["id"] for template in json.loads(existing_records["data"]["templates"])] - ) + existing_market_template_ids = set([template["id"] for template in existing_records["data"]["templates"]]) data = self._build_template_data(serializer, market_record_id=market_record_id) response_data = client.patch_template_scene(data, market_record_id)