Return a model with a collection from a list of entry
517626
def model_from_list(l, header):
        """"""
        col = groups.sortableListe(PseudoAccesCategorie(n) for n in l)
        return MultiSelectModel(col, header)
199938
def _list_model(self, model_cls: Type[X]) -> List[X]:
        """"""
        return self.session.query(model_cls).all()
338635
function(models, out)
  {
    var target = out || this.cloneEmpty();

    for (var i = 0; i < this.length; i++)
    {
      var a = this[ i ];
      var key = a.$key();
      var exists = false;

      if ( models instanceof ModelCollection )
      {
        exists = models.has( key );
      }
      else
      {
        for (var k = 0; k < models.length && !exists; k++)
        {
          var modelKey = this.buildKeyFromInput( models[ k ] );

          exists = (key === modelKey);
        }
      }

      if (!exists)
      {
        target.push( a );
      }
    }

    return target;
  }
1026409
function (collection, action, options) {
                var results = [];
                var self = this,
                    includeInIndexCache = {};

                options = options || {};

                collection.each(function (item) {

                    var includeInIndex,
                        modelClassName = item.constructor.name;

                    if (modelClassName) {
                        if (includeInIndexCache.hasOwnProperty(modelClassName)) {
                            includeInIndex = includeInIndexCache[modelClassName];
                        } else {
                            includeInIndex = ["id"];

                            for (var key in item.schema) {
                                if (item.schema.hasOwnProperty(key)) {
                                    if (item.schema[key].includeInIndex === true) {
                                        includeInIndex.push(key);
                                    }
                                }
                            }

                            includeInIndexCache[modelClassName] = includeInIndex;
                        }
                    }

                    options.includeInIndex = includeInIndex;

                    results.push(self.compose(item, action, options));
                });

                return results;
            }
1029290
def get_for_model(self, obj):
        """"""
        qs = Tag.objects.language(get_language())
        qs = qs.filter(
            tagged_items__content_type=ctype_models.ContentType.objects.get_for_model(obj))  # NOQA
        return qs.distinct()
706055
def from_list(cls, database, key, data, clear=False):
        
        arr = cls(database, key)
        if clear:
            arr.clear()
        arr.extend(data)
        return arr
97504
function() {
    var model = this.definition.model
    var collection = model.include.apply(
      model,
      this.definition.store.utils.args(arguments)
    )

    // add the current record to the collection
    collection.addInternal('data_loaded', [this.clearRelations()]) // clear relations for start with a clean record
    collection.first()

    return collection
  }
635381
function(index){
        var len = arguments.length, i = 0, results;

        if (len > 1) {
            results = [];

            while(len--){
                results.push(this.get(arguments[i++]));
            }

            return results;
        }

        return this._models[index];
    }
682028
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'collections' in _dict:
            args['collections'] = [
                Collection._from_dict(x) for x in (_dict.get('collections'))
            ]
        return cls(**args)
452257
function(model, db, options) {
		// a single model
		if (!isCollection(model)) return db.get(model.id, options.options.get);

		// process query requests
		if (options.query) return db.query(options.query, options.options.query);

		// regular collection fetch
		return db.allDocs(options.options.allDocs);
	}
1093308
def match(self, models, results, relation):
        
        return self.match_one(models, results, relation)
528630
function( model ) {
			var modelColl = model.collection;
			var coll = this.getCollection( model );
			coll && coll._add( model );
			model.collection = modelColl;
		}
328411
def _from_list_record(data):
    
    return [Schema._get_field_entry('Column%d' % (i + 1), value) for i, value in enumerate(data)]
1118861
private Pair<Map<String, Model>, Map<String, Set<String>>> fetchModels() {
    Map<String, Model> all_models = null;
    Map<String, Set<String>> all_models_cols = null;

    if (this.find_compatible_models) {
      // caches for this request
      all_models = (new Models()).fetchAll();
      all_models_cols = new TreeMap<String, Set<String>>();

      for (Map.Entry<String, Model> entry : all_models.entrySet()) {
        all_models_cols.put(entry.getKey(), new TreeSet<String>(Arrays.asList(entry.getValue()._names)));
      }
    }
    return new Pair<Map<String, Model>, Map<String, Set<String>>>(all_models, all_models_cols);
  }
107923
def get_collections(self, data):
        """"""
        collections = self._filter_queryset('view_collection', data.collection_set.all())

        from .collection import CollectionSerializer

        class CollectionWithoutDataSerializer(WithoutDataSerializerMixin, CollectionSerializer):
            """Collection without data field serializer."""

        return self._serialize_items(CollectionWithoutDataSerializer, 'collections', collections)
628167
def bind_collection_to_model_cls(cls):
        
        cls.Collection = type('{0}.Collection'.format(cls.__name__),
                              (cls.Collection,),
                              {'value_type': cls})
        cls.Collection.__module__ = cls.__module__
166515
function (connectionName, collectionName, obj, cb) {
        if (_.isObject(obj)) {
            try {
                var modelInstance = new this._model(obj);
                return cb(null, modelInstance);
            }
            catch (err) {
                return cb(err, null);
            }
        }
    }