From 07d68e6207249163b0480fa6508f6e718fa5c8a4 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Wed, 19 Jul 2023 14:29:15 +0800 Subject: [PATCH] =?UTF-8?q?optimization:=20=E6=B5=81=E7=A8=8B=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=96=B9=E6=A1=88=E6=94=AF=E6=8C=81=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/drf/serilaziers/template_scheme.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcloud/template_base/apis/drf/serilaziers/template_scheme.py b/gcloud/template_base/apis/drf/serilaziers/template_scheme.py index 017970d221..e6f097f1e0 100644 --- a/gcloud/template_base/apis/drf/serilaziers/template_scheme.py +++ b/gcloud/template_base/apis/drf/serilaziers/template_scheme.py @@ -10,9 +10,10 @@ 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. """ -from rest_framework import serializers from typing import List +from rest_framework import serializers + from gcloud.template_base.models import DefaultTemplateScheme from gcloud.utils.drf.serializer import ReadWriteSerializerMethodField @@ -26,6 +27,12 @@ class SchemesSerizlializer(serializers.Serializer): class TemplateSchemeSerializer(SchemesSerizlializer): id = serializers.IntegerField(read_only=True, help_text="执行方案ID") + def update(self, instance, validated_data): + instance.data = validated_data["data"] + instance.name = validated_data["name"] + instance.save() + return instance + class ParamsSerializer(serializers.Serializer): """