From 3b3355f3f88120f2a53afdf93b08f6c50ae194fc Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 16 Feb 2023 17:27:40 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9PostgreSQL=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=8F=82=E6=95=B0=E4=B8=BA=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/asset/database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/assets/serializers/asset/database.py b/apps/assets/serializers/asset/database.py index 4c00c486c..9f5e97dba 100644 --- a/apps/assets/serializers/asset/database.py +++ b/apps/assets/serializers/asset/database.py @@ -19,7 +19,8 @@ class DatabaseSerializer(AssetSerializer): def validate(self, attrs): platform = attrs.get('platform') - if platform and getattr(platform, 'type') == 'mongodb' \ + db_type_required = ('mongodb', 'postgresql') + if platform and getattr(platform, 'type') in db_type_required \ and not attrs.get('db_name'): raise ValidationError({'db_name': _('This field is required.')}) return attrs