mirror of https://github.com/jumpserver/jumpserver
fix: 修复克隆网关没有克隆账号的问题
parent
f3b529170d
commit
e25306608b
|
@ -3,10 +3,10 @@ from django.utils.translation import ugettext as _
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from rest_framework.serializers import ValidationError
|
from rest_framework.serializers import ValidationError
|
||||||
from rest_framework.views import APIView, Response
|
from rest_framework.views import APIView, Response
|
||||||
|
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
from assets.tasks import test_gateways_connectivity_manual
|
from assets.tasks import test_gateways_connectivity_manual
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
|
from .asset import AssetViewSet
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
from ..models import Domain, Gateway
|
from ..models import Domain, Gateway
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class DomainViewSet(OrgBulkModelViewSet):
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
|
|
||||||
class GatewayViewSet(OrgBulkModelViewSet):
|
class GatewayViewSet(AssetViewSet):
|
||||||
perm_model = Gateway
|
perm_model = Gateway
|
||||||
filterset_fields = ("domain__name", "name", "domain")
|
filterset_fields = ("domain__name", "name", "domain")
|
||||||
search_fields = ("domain__name",)
|
search_fields = ("domain__name",)
|
||||||
|
|
|
@ -20,9 +20,7 @@ class GatewaySerializer(HostSerializer):
|
||||||
queryset = queryset.exclude(id=self.instance.id)
|
queryset = queryset.exclude(id=self.instance.id)
|
||||||
has = queryset.exists()
|
has = queryset.exists()
|
||||||
if has:
|
if has:
|
||||||
raise serializers.ValidationError(
|
raise serializers.ValidationError(_('This field must be unique.'))
|
||||||
_('This field must be unique.')
|
|
||||||
)
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue