From 01f163ce7182cef42d5b092b7b2c6fe5c208ea90 Mon Sep 17 00:00:00 2001 From: Eric Costa Date: Fri, 9 Aug 2024 09:15:53 -0300 Subject: [PATCH] feat: update brain_on by validated data --- connect/api/v2/projects/serializers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/connect/api/v2/projects/serializers.py b/connect/api/v2/projects/serializers.py index 61dce3b9..8dde2bc4 100644 --- a/connect/api/v2/projects/serializers.py +++ b/connect/api/v2/projects/serializers.py @@ -52,6 +52,7 @@ class Meta: "authorization", "project_type", "description", + "brain_on" ] ref_name = None @@ -76,6 +77,7 @@ class Meta: authorization = serializers.SerializerMethodField(style={"show": False}) project_type = serializers.SerializerMethodField() + brain_on = serializers.BooleanField(default=False) def get_project_type(self, obj): if obj.is_template: @@ -89,11 +91,12 @@ def create(self, validated_data): template_uuid = self.context["request"].data.get("uuid") is_template = self.context["request"].data.get("template", False) + brain_on = self.context["request"].data.get('brain_on', False) if extra_data: template_uuid = extra_data.get("uuid", template_uuid) is_template = extra_data.get("template", is_template) - + brain_on = extra_data.get('brain_on', False) project_template_type = None template_name = "blank" if is_template: @@ -101,9 +104,6 @@ def create(self, validated_data): if project_template_type_queryset.exists(): project_template_type = project_template_type_queryset.first() template_name = project_template_type.name - - # brain_on = True if template_name == "blank" else False - brain_on = False instance = Project.objects.create( name=validated_data.get("name"), timezone=str(validated_data.get("timezone")),