فهرست منبع

Fixes #15126: group field should be optional when creating VPN tunnel via REST API

Jeremy Stretch 2 سال پیش
والد
کامیت
df910928f2
2فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 1
      netbox/vpn/api/serializers.py
  2. 0 1
      netbox/vpn/tests/test_api.py

+ 4 - 1
netbox/vpn/api/serializers.py

@@ -46,7 +46,10 @@ class TunnelSerializer(NetBoxModelSerializer):
     status = ChoiceField(
     status = ChoiceField(
         choices=TunnelStatusChoices
         choices=TunnelStatusChoices
     )
     )
-    group = NestedTunnelGroupSerializer()
+    group = NestedTunnelGroupSerializer(
+        required=False,
+        allow_null=True
+    )
     encapsulation = ChoiceField(
     encapsulation = ChoiceField(
         choices=TunnelEncapsulationChoices
         choices=TunnelEncapsulationChoices
     )
     )

+ 0 - 1
netbox/vpn/tests/test_api.py

@@ -105,7 +105,6 @@ class TunnelTest(APIViewTestCases.APIViewTestCase):
             {
             {
                 'name': 'Tunnel 6',
                 'name': 'Tunnel 6',
                 'status': TunnelStatusChoices.STATUS_DISABLED,
                 'status': TunnelStatusChoices.STATUS_DISABLED,
-                'group': tunnel_groups[1].pk,
                 'encapsulation': TunnelEncapsulationChoices.ENCAP_GRE,
                 'encapsulation': TunnelEncapsulationChoices.ENCAP_GRE,
             },
             },
         ]
         ]