'Given a module containing models, returns a list of the models.
Otherwise returns a list of all installed models.
By default, auto-created models (i.e., m2m models without an
explicit intermediate table) are not included. However, if you
specify include_auto_created=True, they will be.
By default, models created to satisfy deferred attribute
queries are *not* included in the list of models. However, if
you specify include_deferred, they will be.
By default, models that aren\'t part of installed apps will *not*
be included in the list of models. However, if you specify
only_installed=False, they will be.
By default, models that have been swapped out will *not* be
included in the list of models. However, if you specify
include_swapped, they will be.'

def get_models(self, app_mod=None, include_auto_created=False, include_deferred=False, only_installed=True, include_swapped=False):

    cache_key = (app_mod, include_auto_created, include_deferred, only_installed, include_swapped)
    model_list = None
    try:
        model_list = self._get_models_cache[cache_key]
        if ((self.available_apps is not None) and only_installed):
            model_list = [m for m in model_list if (m._meta.app_label in self.available_apps)]
        return model_list
    except KeyError:
        pass
    self._populate()
    if app_mod:
        if (app_mod in self.app_store):
            app_list = [self.app_models.get(self._label_for(app_mod), SortedDict())]
        else:
            app_list = []
    elif only_installed:
        app_list = [self.app_models.get(app_label, SortedDict()) for app_label in six.iterkeys(self.app_labels)]
    else:
        app_list = six.itervalues(self.app_models)
    model_list = []
    for app in app_list:
        model_list.extend((model for model in app.values() if (((not model._deferred) or include_deferred) and ((not model._meta.auto_created) or include_auto_created) and ((not model._meta.swapped) or include_swapped))))
    self._get_models_cache[cache_key] = model_list
    if ((self.available_apps is not None) and only_installed):
        model_list = [m for m in model_list if (m._meta.app_label in self.available_apps)]
    return model_list
