module documentation

Undocumented

Class ForeignKey Provide a many-to-one relation by adding a column to the local model to hold the remote value.
Class ForeignObject Abstraction of the ForeignKey relation to support multi-column relations.
Class ManyToManyField 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 OneToOneField A OneToOneField is essentially the same as a ForeignKey, with the exception that it always carries a "unique" constraint with it and the reverse relation always returns the object pointed to (since there will only ever be one), rather than returning a list.
Class RelatedField Base class that all relational fields inherit from.
Function create_many_to_many_intermediary_model Undocumented
Function lazy_related_operation 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.
Function resolve_relation Transform relation into a model or fully-qualified model string of the form "app_label.ModelName", relative to scope_model.
Constant RECURSIVE_RELATIONSHIP_CONSTANT Undocumented
def create_many_to_many_intermediary_model(field, klass): (source)

Undocumented

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

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): (source)

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.

RECURSIVE_RELATIONSHIP_CONSTANT: str = (source)

Undocumented

Value
'self'