The ManyToMany field on the item class pointing to this class.

        If there is more than one field, this value will be None.
497107
def item_related_name(self):
        
        if not hasattr(self, '_item_related_name'):
            many_to_many_rels = \
                get_section_many_to_many_relations(self.__class__)
            if len(many_to_many_rels) != 1:
                self._item_related_name = None
            else:
                self._item_related_name = many_to_many_rels[0].field.name
        return self._item_related_name
714491
def index(self, values=None, only_index=None):
        
        assert self.indexable, "Field not indexable"
        assert not only_index or self.has_index(only_index), "Invalid index"
        if only_index:
            only_index = only_index if isclass(only_index) else only_index.__class__

        if values is None:
            values = self.proxy_get()

        for value in values:
            if value is not None:
                needs_to_check_uniqueness = bool(self.unique)

                for index in self._indexes:
                    if only_index and not isinstance(index, only_index):
                        continue

                    index.add(value, check_uniqueness=needs_to_check_uniqueness and index.handle_uniqueness)

                    if needs_to_check_uniqueness and index.handle_uniqueness:
                        # uniqueness check is done for this value
                        needs_to_check_uniqueness = False
940936
@Nullable
    private String isFieldCollection(OpcodeStack.Item item) throws ClassNotFoundException {
        Comparable<?> aliasReg = (Comparable<?>) item.getUserValue();
        if (aliasReg instanceof String) {
            return (String) aliasReg;
        }

        XField field = item.getXField();
        if (field == null) {
            return null;
        }

        JavaClass cls = item.getJavaClass();
        if ((cls != null) && cls.implementationOf(collectionClass)) {
            return field.getName();
        }

        return null;
    }
965249
def initialize_fields(self, content):
        
        for name, value in content.items():
            item = self[name]
            # Container or Pointer
            if is_mixin(item):
                item.initialize_fields(value)
            # Fields
            elif is_field(item):
                item.value = value
            else:
                raise MemberTypeError(self, item, name)
534063
def fieldnames(self):
        ''' 
        '''
        if not self._fields:
            if self._item_class is not None:
                for m in inspect.getmembers(self._item_class):
                    if m[0] == 'fields' and isinstance(m[1], dict):
                        self._fields = m[1]
                if not self._fields:
                    raise RuntimeError('Unknown item type, no fields: %s' % self._item_class)
            else:
                raise RuntimeError('Item class is not defined, %s' % self._item_class)
        return self._fields.keys()
107116
def _converter(self, value):
        
        if type(value) is not self.related_model_cls.Collection:
            value = self.related_model_cls.Collection([
                self._get_model_instance(self.related_model_cls, item)
                for item in value])
        return value
553578
def drop_remove(*args, **kwargs):
        
        dropped_item = args[0]
        field_list = kwargs['field_list']
        num_duplicate = 0
        for i in range(field_list.count()):
            if dropped_item.text() == field_list.item(i).text():
                num_duplicate += 1
        if num_duplicate > 1:
            # Notes(IS): For some reason, removeItemWidget is not working.
            field_list.takeItem(field_list.row(dropped_item))
1291087
@Override
    public void addValuesForField() {
        FieldDefinition fieldDef = m_tableDef.getFieldDef(m_fieldName);
        if (fieldDef == null || !fieldDef.isCollection()) {
            addSVScalar();
        } else {
            addMVScalar();
        }
    }
886386
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case ITEM_ID:
      return isSetItemId();
    case COUNT:
      return isSetCount();
    case VARIABLE_TYPES:
      return isSetVariable_types();
    case VARIABLE_NAMES:
      return isSetVariable_names();
    }
    throw new IllegalStateException();
  }
459867
def get_all_related_many_to_many_objects(opts):
    
    if django.VERSION < (1, 9):
        return opts.get_all_related_many_to_many_objects()
    else:
        return [r for r in opts.related_objects if r.field.many_to_many]
357232
def item_coords(self, table_item):
        
        for row_key in self.children.keys():
            for item_key in self.children[row_key].children.keys():
                if self.children[row_key].children[item_key] == table_item:
                    return (int(row_key), int(item_key))
        return None
1115941
def recordItemClass(self, record=None):
        
        if record is not None:
            key = type(record)
        else:
            key = None
        
        return self._recordItemClass.get(key, self._recordItemClass[None])
148454
def add_item(self, item, field_name=None):
        
        field_name = self._choose_field_name(field_name)
        related_manager = getattr(item, field_name)
        related_manager.add(self)
1021463
protected function setOnField(FieldCollection $field, $value)
    {
        if (!is_array($value)) {
            if ($field->getMaxItems() != 1) {
                throw new MultipleFieldAssignmentException('You cannot assign a value to replace a multiple field');
            }

            $field->offsetSet(static::$SINGLE_ITEM_KEY, $value);

            return;
        }

        $field->clear();

        // This happens when the array is
        // replaced completely by another array
        if (count($value)) {
            foreach ($value as $k => $v) {
                $field->offsetSet($k, $v);
            }
        }
    }
964609
def match_field(field_class):
    
    for cls in field_class.mro():
        if cls in list(LOOKUP_TABLE.keys()):
            return cls
    # could not match the field class
    raise Exception('{0} None Found '.format(field_class))
1186941
private String getSpecificJoinFetchAnnotation() {
        List<Relation> manyToManyRelations = relation.getToEntity().getManyToMany().getList();
        // we have only on many-to-many ? No problem, move on
        if (manyToManyRelations.size() <= 1) {
            return null;
        }
        // we have many many to many relations ? and one requires eager, then we need to set the fetchmode
        for (Relation relation : manyToManyRelations) {
            if (relation.getFetchTypeGetter() != null && relation.getFetchTypeGetter().getFetch() != null && relation.getFetchTypeGetter().getFetch().isEager()) {
                addImport("org.hibernate.annotations.Fetch");
                addImport("org.hibernate.annotations.FetchMode");
                return "@Fetch(value = FetchMode.SUBSELECT)";
            }
        }
        // no eager requested, move on
        return null;
    }
829537
def related_items_changed(self, instance, related_manager):
        
        try:
            count = related_manager.count_queryset()
        except AttributeError:
            count = related_manager.count()
        count_field_name = list(self.fields.keys())[0] % \
                           self.related_field_name
        setattr(instance, count_field_name, count)
        instance.save()