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

Method get_models

django/apps/config.py:241–260  ·  view source on GitHub ↗

Return an iterable of 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 t

(self, include_auto_created=False, include_swapped=False)

Source from the content-addressed store, hash-verified

239 )
240
241 def get_models(self, include_auto_created=False, include_swapped=False):
242 """
243 Return an iterable of models.
244
245 By default, the following models aren't included:
246
247 - auto-created models for many-to-many relations without
248 an explicit intermediate table,
249 - models that have been swapped out.
250
251 Set the corresponding keyword argument to True to include such models.
252 Keyword arguments aren't documented; they're a private API.
253 """
254 self.apps.check_models_ready()
255 for model in self.models.values():
256 if model._meta.auto_created and not include_auto_created:
257 continue
258 if model._meta.swapped and not include_swapped:
259 continue
260 yield model
261
262 def import_models(self):
263 # Dictionary of models for this app, primarily maintained in the

Callers

nothing calls this directly

Calls 2

check_models_readyMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected