module documentation

Undocumented

Class ​App​Config​Stub Stub of an AppConfig. Only provides a label and a dict of models.
Class ​Model​State Represent a Django Model. Don't use the actual Model class as it's not designed to have its options changed - instead, mutate this one and then render it into a Model as required.
Class ​Project​State Represent the entire project's overall state. This is the item that is passed around - do it here rather than at the app level so that cross-app FKs/etc. resolve properly.
Class ​State​Apps Subclass of the global Apps registry class to better handle dynamic model additions and removals.
Function ​_get​_app​_label​_and​_model​_name Undocumented
Function ​_get​_related​_models Return all models that have a direct relationship to the given model.
Function get​_related​_models​_recursive Return all models that have a direct or indirect relationship to the given model.
Function get​_related​_models​_tuples Return a list of typical (app_label, model_name) tuples for all related models for the given model.
def _get_app_label_and_model_name(model, app_label=''):

Undocumented

def _get_related_models(m):
Return all models that have a direct relationship to the given model.
def get_related_models_recursive(model):

Return all models that have a direct or indirect relationship to the given model.

Relationships are either defined by explicit relational fields, like ForeignKey, ManyToManyField or OneToOneField, or by inheriting from another model (a superclass is related to its subclasses, but not vice versa). Note, however, that a model inheriting from a concrete model is also related to its superclass through the implicit *_ptr OneToOneField on the subclass.

def get_related_models_tuples(model):
Return a list of typical (app_label, model_name) tuples for all related models for the given model.