VPN close to being done
diff --git a/xos/services/vpn/admin.py b/xos/services/vpn/admin.py
index 0f474d3..d70252b 100644
--- a/xos/services/vpn/admin.py
+++ b/xos/services/vpn/admin.py
@@ -20,7 +20,7 @@
super(VPNServiceForm, self).__init__(*args, **kwargs)
if self.instance:
- self.fields['exposed_ports'].initial = self.instance.exposed_ports
+ self.fields['exposed_ports'].initial = self.instance.exposed_ports[self.instance.protocol]
def save(self, commit=True):
self.instance.exposed_ports = self.cleaned_data['exposed_ports']
diff --git a/xos/services/vpn/models.py b/xos/services/vpn/models.py
index d190424..b97eaa9 100644
--- a/xos/services/vpn/models.py
+++ b/xos/services/vpn/models.py
@@ -31,7 +31,7 @@
raise XOSValidationError("Port protocol must be udp or tcp")
if not self.exposed_ports[protocol]:
raise XOSValidationError("No availble ports for protocol: " + protocol)
- tenants = [tenant for tenant in VPNTenant.get_tenant_objects.all() if tenant.protocol == protocol]
+ tenants = [tenant for tenant in VPNTenant.get_tenant_objects().all() if tenant.protocol == protocol]
port_numbers = self.exposed_ports[protocol]
for port_number in port_numbers:
if [tenant for tenant in tenants if tenant.port_number == port_number].count() == 0: