mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-05-30 10:34:40 +00:00
* [Update] 改密支持windows * [Update] 修改asset表结构 * [Feature] Windows支持批量改密、测试可连接性等功能 * [Update] 处理创建资产时labels的问题 * [Update] 优化测试管理系统、系统用户可连接性任务执行逻辑 * [Update] 优化ansible任务逻辑;添加自动推送rdp系统用户功能 * [Update] 添加翻译 * [Update] 优化ansible任务逻辑(测试系统用户可连接性, 通过协议过滤资产) * [Update] 更新翻译 * [Update] 更新翻译 * [Update] 推送windows系统用户,默认添加到Users、Remote Desktop Users组中 * [Update] 优化小细节 * [Update] 更新翻译,删除多余代码 * [Update] 更新翻译信息
25 lines
717 B
Python
25 lines
717 B
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
from django.core.validators import RegexValidator
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from rest_framework.validators import (
|
|
UniqueTogetherValidator, ValidationError
|
|
)
|
|
|
|
|
|
alphanumeric = RegexValidator(r'^[0-9a-zA-Z_@\-\.]*$', _('Special char not allowed'))
|
|
|
|
|
|
class ProjectUniqueValidator(UniqueTogetherValidator):
|
|
def __call__(self, attrs):
|
|
try:
|
|
super().__call__(attrs)
|
|
except ValidationError as e:
|
|
errors = {}
|
|
for field in self.fields:
|
|
if field == "org_id":
|
|
continue
|
|
errors[field] = _('This field must be unique.')
|
|
raise ValidationError(errors)
|