do not return servicenetwork if id is null
Change-Id: I0800a738e938dc97643d52285da1f04c102057c1
diff --git a/xos/api/service/vtn.py b/xos/api/service/vtn.py
index 778c145..d78e1a9 100644
--- a/xos/api/service/vtn.py
+++ b/xos/api/service/vtn.py
@@ -197,11 +197,12 @@
def get_networks(self, request):
result=[]
for network in Network.objects.all():
- result.append(VTNNetworkSerializer(VTNNetwork(network)).data)
+ network = VTNNetwork(network)
+ if network.id is not None:
+ result.append(VTNNetworkSerializer(network).data)
return Response({"networks": result})
def get_network(self, request, network_id=None):
- #network = Network.objects.filter(network_id = network_id)
network = [x for x in Network.objects.all() if VTNNetwork(x).id == network_id]
if network:
network=network[0]
@@ -212,11 +213,12 @@
def get_service_networks(self, request):
result=[]
for network in Network.objects.all():
- result.append(VTNServiceNetworkSerializer(VTNNetwork(network)).data)
+ network = VTNNetwork(network)
+ if network.id is not None:
+ result.append(VTNServiceNetworkSerializer(network).data)
return Response({"serviceNetworks": result})
def get_service_network(self, request, network_id=None):
- #network = Network.objects.filter(network_id = network_id)
network = [x for x in Network.objects.all() if VTNNetwork(x).id == network_id]
if network:
network=network[0]