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): """