'Return a list of all installed models.
By default, the following models aren\'t included:
- auto-created models for many-to-many relations without
an explicit intermediate table,
- models that have been swapped out.
Set the corresponding keyword argument to True to include such models.'

@functools.lru_cache(maxsize=None)
def get_models(self, include_auto_created=False, include_swapped=False):

    self.check_models_ready()
    result = []
    for app_config in self.app_configs.values():
        result.extend(list(app_config.get_models(include_auto_created, include_swapped)))
    return result
