module documentation

Undocumented

Constant RECURSIVE​_RELATIONSHIP​_CONSTANT Undocumented
Class ​Foreign​Key Provide a many-to-one relation by adding a column to the local model to hold the remote value.
Class ​Foreign​Object Abstraction of the ForeignKey relation to support multi-column relations.
Class ​Many​To​Many​Field Provide a many-to-many relation by using an intermediary model that holds two ForeignKey fields pointed at the two sides of the relation.
Class ​One​To​One​Field No summary
Class ​Related​Field Base class that all relational fields inherit from.
Function create​_many​_to​_many​_intermediary​_model Undocumented
Function lazy​_related​_operation No summary
Function resolve​_relation Transform relation into a model or fully-qualified model string of the form "app_label.ModelName", relative to scope_model.
RECURSIVE_RELATIONSHIP_CONSTANT: str =

Undocumented

Value
'self'
def create_many_to_many_intermediary_model(field, klass):

Undocumented

def lazy_related_operation(function, model, *related_models, **kwargs):

Schedule function to be called once model and all related_models have been imported and registered with the app registry. function will be called with the newly-loaded model classes as its positional arguments, plus any optional keyword arguments.

The model argument must be a model class. Each subsequent positional argument is another model, or a reference to another model - see resolve_relation() for the various forms these may take. Any relative references will be resolved relative to model.

This is a convenience wrapper for Apps.lazy_model_operation - the app registry model used is the one found in model._meta.apps.

def resolve_relation(scope_model, relation):

Transform relation into a model or fully-qualified model string of the form "app_label.ModelName", relative to scope_model.

The relation argument can be:
  • RECURSIVE_RELATIONSHIP_CONSTANT, i.e. the string "self", in which case the model argument will be returned.
  • A bare model name without an app_label, in which case scope_model's app_label will be prepended.
  • An "app_label.ModelName" string.
  • A model class, which will be returned unchanged.