parameters: (model, ids, fields=None)
docstring: Fetches a dict of model details for model instances with the given
      ids, keyed by their id.
  
      If a fields list is given, a dict of details will be retrieved for
      each model, otherwise complete model instances will be retrieved.
  
      Any fields list given shouldn't contain the primary key attribute for
      the model, as this can be determined from its Options.
docstring_summary: Fetches a dict of model details for model instances with the given
      ids, keyed by their id.
docstring_tokens: Fetches a dict of model details for model instances with the given ids keyed by their id .
function: def fetch_model_dict(model, ids, fields=None):
      """
      Fetches a dict of model details for model instances with the given
      ids, keyed by their id.
  
      If a fields list is given, a dict of details will be retrieved for
      each model, otherwise complete model instances will be retrieved.
  
      Any fields list given shouldn't contain the primary key attribute for
      the model, as this can be determined from its Options.
      """
      if fields is None:
          return model._default_manager.in_bulk(ids)
      else:
          id_attr = model._meta.pk.attname
          return dict((obj[id_attr], obj) for obj
              in model._default_manager.filter(id__in=ids).values(
                  *itertools.chain((id_attr,), fields)))
function_tokens: def fetch_model_dict ( model , ids , fields = None ) : if fields is None : return model . _default_manager . in_bulk ( ids ) else : id_attr = model . _meta . pk . attname return dict ( ( obj [ id_attr ] , obj ) for obj in model . _default_manager . filter ( id__in = ids ) . values ( * itertools . chain ( ( id_attr , ) , fields ) ) )