MCPcopy
hub / github.com/django/django / get_models

Method get_models

django/apps/registry.py:169–186  ·  view source on GitHub ↗

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 a

(self, include_auto_created=False, include_swapped=False)

Source from the content-addressed store, hash-verified

167 # This method is performance-critical at least for Django's test suite.
168 @functools.cache
169 def get_models(self, include_auto_created=False, include_swapped=False):
170 """
171 Return a list of all installed models.
172
173 By default, the following models aren't included:
174
175 - auto-created models for many-to-many relations without
176 an explicit intermediate table,
177 - models that have been swapped out.
178
179 Set the corresponding keyword argument to True to include such models.
180 """
181 self.check_models_ready()
182
183 result = []
184 for app_config in self.app_configs.values():
185 result.extend(app_config.get_models(include_auto_created, include_swapped))
186 return result
187
188 def get_model(self, app_label, model_name=None, require_ready=True):
189 """

Callers 15

check_models_permissionsFunction · 0.45
create_permissionsFunction · 0.45
_build_kml_sourcesMethod · 0.45
check_model_name_lengthsFunction · 0.45
create_contenttypesFunction · 0.45
get_context_dataMethod · 0.45
sort_dependenciesFunction · 0.45
check_all_modelsFunction · 0.45
handleMethod · 0.45

Calls 3

check_models_readyMethod · 0.95
extendMethod · 0.80
valuesMethod · 0.45