

def get_context_data(self, request):
    l2policy_id = self.tab_group.kwargs['l2policy_id']
    try:
        l2policy = client.l2policy_get(request, l2policy_id)
        ptgs = []
        for item in l2policy.policy_target_groups:
            ptgs.append(client.policy_target_get(request, item))
        setattr(l2policy, 'ptgs', ptgs)
    except Exception:
        exceptions.handle(request, _('Unable to retrieve l2 policy details.'), redirect=self.failure_url)
    return {
        'l2policy': l2policy,
    }

dataset/ETHPy150Open openstack/group-based-policy-ui/gbpui/panels/network_policy/tabs.py L2PolicyDetailsTab.get_context_data/original