[Update] 修改校验规则

pull/2957/head
ibuler 5 years ago
parent 106abc24f8
commit 875a069a18

@ -36,6 +36,9 @@ class CommandFilterRuleSerializer(BulkOrgResourceModelSerializer):
list_serializer_class = AdaptedBulkListSerializer list_serializer_class = AdaptedBulkListSerializer
def validate_content(self, content): def validate_content(self, content):
tp = self.initial_data.get("type")
if tp == CommandFilterRule.TYPE_REGEX:
return content
if self.invalid_pattern.search(content): if self.invalid_pattern.search(content):
invalid_char = self.invalid_pattern.pattern.replace('\\', '') invalid_char = self.invalid_pattern.pattern.replace('\\', '')
msg = _("Content should not be contain: {}").format(invalid_char) msg = _("Content should not be contain: {}").format(invalid_char)

Loading…
Cancel
Save