

def __init__(self, request, *args, **kwargs):
    super(CreateExternalConnectivityForm, self).__init__(request, *args, **kwargs)
    net_id_list = []
    dic = {
        'router:external': True,
    }
    try:
        net_list = api.neutron.network_list(request, **dic)
        subnet_list = api.neutron.subnet_list(request)
        net_id_list = [net.id for net in net_list]
        self.fields['subnet_id'].choices = ([('', 'Select')] + [(subnet.id, subnet.name) for subnet in subnet_list if (subnet.network_id in net_id_list)])
    except Exception:
        msg = _('Failed to get Subnet ID list.')
        exceptions.handle(request, msg)

dataset/ETHPy150Open openstack/group-based-policy-ui/gbpui/panels/network_policy/forms.py CreateExternalConnectivityForm.__init__/original