def get_context_data(self, **kwargs):
        context = super(ManageResourceTypes, self).get_context_data(**kwargs)

        selected_type_names = [selected_type['name'] for selected_type in
                               context['form'].initial['resource_types']]

        try:
            # Set the basic types that aren't already associated
            result = [unselected_type for unselected_type in
                      glance.metadefs_resource_types_list(self.request)
                      if selected_type_names not in unselected_type['name']]
        except Exception:
            result = []
            msg = _('Error getting resource type associations.')
            exceptions.handle(self.request, msg)

        # Add the resource types previously associated, includes prefix, etc
        for initial_type in context['form'].initial['resource_types']:
            selected_type = initial_type.copy()
            selected_type['selected'] = True
            result.insert(0, selected_type)

        context['id'] = self.kwargs['id']
        try:
            context["resource_types"] = json.dumps(result)
        except Exception:
            context["resource_types"] = "[]"
            msg = _('Error getting resource type associations.')
            exceptions.handle(self.request, msg)

        return context
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/admin/metadata_defs/views.py/ManageResourceTypes.get_context_data/swapped operands of `not in`