mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-01 23:47:40 +00:00
fix: 修复克隆网关没有克隆账号的问题
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user