fix: sftp不能设置为默认存储

This commit is contained in:
wangruidong
2023-11-28 15:07:17 +08:00
committed by 老广
parent 24987c7f60
commit b10ee436e8

View File

@@ -281,3 +281,10 @@ class ReplayStorageSerializer(BaseStorageSerializer):
extra_kwargs = {
'name': {'validators': [UniqueValidator(queryset=ReplayStorage.objects.all())]}
}
def validate_is_default(self, value):
if self.initial_data.get('type') == const.ReplayStorageType.sftp.value:
# sftp不能设置为默认存储
return False
else:
return value