class documentation

class Options: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method add_field Undocumented
Method add_manager Undocumented
Method can_migrate Return True if the model can/should be migrated on the `connection`. `connection` can be either a real connection or a connection alias.
Method contribute_to_class Undocumented
Method get_ancestor_link Return the field on the current model which points to the given "ancestor". This is possible an indirect link (a pointer to a parent model, which points, eventually, to the ancestor). Used when constructing table joins for model inheritance.
Method get_base_chain Return a list of parent classes leading to `model` (ordered from closest to most distant ancestor). This has to handle the case where `model` is a grandparent or even more distant relation.
Method get_field Return a field instance given the name of a forward or reverse field.
Method get_fields Return a list of fields associated to the model. By default, include forward and reverse fields, fields derived from inheritance, but not hidden fields. The returned fields can be changed using the parameters:...
Method get_parent_list Return all the ancestors of this model as a list ordered by MRO. Useful for determining if something is an ancestor, regardless of lineage.
Method get_path_from_parent Return a list of PathInfos containing the path from the parent model to the current model, or an empty list if parent is not a parent of the current model.
Method get_path_to_parent Return a list of PathInfos containing the path from the current model to the parent model, or an empty list if parent is not a parent of the current model.
Method setup_pk Undocumented
Method setup_proxy Do the internal setup so that the current model is a proxy for "target".
Constant FORWARD_PROPERTIES Undocumented
Constant REVERSE_PROPERTIES Undocumented
Instance Variable abstract Undocumented
Instance Variable app_label Undocumented
Instance Variable apps Undocumented
Instance Variable auto_created Undocumented
Instance Variable auto_field Undocumented
Instance Variable base_manager_name Undocumented
Instance Variable concrete_model Undocumented
Instance Variable constraints Undocumented
Instance Variable db_table Undocumented
Instance Variable db_tablespace Undocumented
Instance Variable default_manager_name Undocumented
Instance Variable default_permissions Undocumented
Instance Variable default_related_name Undocumented
Instance Variable get_latest_by Undocumented
Instance Variable index_together Undocumented
Instance Variable indexes Undocumented
Instance Variable local_fields Undocumented
Instance Variable local_managers Undocumented
Instance Variable local_many_to_many Undocumented
Instance Variable managed Undocumented
Instance Variable meta Undocumented
Instance Variable model Undocumented
Instance Variable model_name Undocumented
Instance Variable object_name Undocumented
Instance Variable order_with_respect_to Undocumented
Instance Variable ordering Undocumented
Instance Variable original_attrs Undocumented
Instance Variable parents Undocumented
Instance Variable permissions Undocumented
Instance Variable pk Undocumented
Instance Variable private_fields Undocumented
Instance Variable proxy Undocumented
Instance Variable proxy_for_model Undocumented
Instance Variable related_fkey_lookups Undocumented
Instance Variable required_db_features Undocumented
Instance Variable required_db_vendor Undocumented
Instance Variable select_on_save Undocumented
Instance Variable swappable Undocumented
Instance Variable unique_together Undocumented
Instance Variable verbose_name Undocumented
Instance Variable verbose_name_plural Undocumented
Property app_config Undocumented
Property base_manager Undocumented
Property concrete_fields Return a list of all concrete fields on the model and its parents.
Property db_returning_fields Private API intended only to be used by Django itself. Fields to be returned after a database insert.
Property default_manager Undocumented
Property fields Return a list of all forward fields on the model and its parents, excluding ManyToManyFields.
Property fields_map Undocumented
Property label Undocumented
Property label_lower Undocumented
Property local_concrete_fields Return a list of all concrete fields on the model.
Property managers Undocumented
Property managers_map Undocumented
Property many_to_many Return a list of all many to many fields on the model and its parents.
Property related_objects Return all related objects pointing to the current model. The related objects can come from a one-to-one, one-to-many, or many-to-many field relation type.
Property swapped Has this model been swapped out for another? If so, return the model name of the replacement; otherwise, return None.
Property total_unique_constraints Return a list of total unique constraints. Useful for determining set of fields guaranteed to be unique for all rows.
Property verbose_name_raw Return the untranslated verbose name.
Method _expire_cache Undocumented
Method _format_names_with_class App label/class name interpolation for object names.
Method _get_default_pk_class Undocumented
Method _get_fields Internal helper function to return fields of the model. * If forward=True, then fields defined on this model are returned. * If reverse=True, then relations pointing to this model are returned. * If include_hidden=True, then fields with is_hidden=True are returned...
Method _populate_directed_relation_graph This method is used by each model to find its reverse objects. As this method is very expensive and is accessed frequently (it looks up every field in a model, in every app), it is computed on first access and then is set as a property on every model.
Method _prepare Undocumented
Instance Variable _get_fields_cache Undocumented
Instance Variable _ordering_clash Undocumented
Property _forward_fields_map Undocumented
Property _property_names Return a set of the names of the properties defined on the model.
Property _relation_tree Undocumented
def __init__(self, meta, app_label=None): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __str__(self): (source)

Undocumented

def add_field(self, field, private=False): (source)

Undocumented

def add_manager(self, manager): (source)

Undocumented

def can_migrate(self, connection): (source)

Return True if the model can/should be migrated on the `connection`. `connection` can be either a real connection or a connection alias.

def contribute_to_class(self, cls, name): (source)

Undocumented

def get_ancestor_link(self, ancestor): (source)

Return the field on the current model which points to the given "ancestor". This is possible an indirect link (a pointer to a parent model, which points, eventually, to the ancestor). Used when constructing table joins for model inheritance. Return None if the model isn't an ancestor of this one.

def get_base_chain(self, model): (source)

Return a list of parent classes leading to `model` (ordered from closest to most distant ancestor). This has to handle the case where `model` is a grandparent or even more distant relation.

def get_field(self, field_name): (source)

Return a field instance given the name of a forward or reverse field.

def get_fields(self, include_parents=True, include_hidden=False): (source)

Return a list of fields associated to the model. By default, include forward and reverse fields, fields derived from inheritance, but not hidden fields. The returned fields can be changed using the parameters: - include_parents: include fields derived from inheritance - include_hidden: include fields that have a related_name that starts with a "+"

def get_parent_list(self): (source)

Return all the ancestors of this model as a list ordered by MRO. Useful for determining if something is an ancestor, regardless of lineage.

def get_path_from_parent(self, parent): (source)

Return a list of PathInfos containing the path from the parent model to the current model, or an empty list if parent is not a parent of the current model.

def get_path_to_parent(self, parent): (source)

Return a list of PathInfos containing the path from the current model to the parent model, or an empty list if parent is not a parent of the current model.

def setup_pk(self, field): (source)

Undocumented

def setup_proxy(self, target): (source)

Do the internal setup so that the current model is a proxy for "target".

FORWARD_PROPERTIES: set[str] = (source)

Undocumented

Value
set(['fields',
     'many_to_many',
     'concrete_fields',
     'local_concrete_fields',
     '_forward_fields_map',
     'managers',
     'managers_map',
...
REVERSE_PROPERTIES: set[str] = (source)

Undocumented

Value
set(['related_objects', 'fields_map', '_relation_tree'])
abstract: bool = (source)

Undocumented

app_label = (source)

Undocumented

Undocumented

auto_created: bool = (source)

Undocumented

auto_field = (source)

Undocumented

base_manager_name = (source)

Undocumented

concrete_model = (source)

Undocumented

constraints: list = (source)

Undocumented

db_table = (source)

Undocumented

db_tablespace = (source)

Undocumented

default_manager_name = (source)

Undocumented

default_permissions: tuple[str, ...] = (source)

Undocumented

default_related_name = (source)

Undocumented

get_latest_by = (source)

Undocumented

index_together = (source)

Undocumented

Undocumented

local_fields: list = (source)

Undocumented

local_managers: list = (source)

Undocumented

local_many_to_many: list = (source)

Undocumented

Undocumented

Undocumented

Undocumented

model_name = (source)

Undocumented

object_name = (source)

Undocumented

order_with_respect_to = (source)

Undocumented

ordering: tuple[str, ...] = (source)

Undocumented

original_attrs: dict = (source)

Undocumented

Undocumented

permissions: list = (source)

Undocumented

Undocumented

private_fields: list = (source)

Undocumented

Undocumented

proxy_for_model = (source)

Undocumented

related_fkey_lookups: list = (source)

Undocumented

required_db_features: list = (source)

Undocumented

required_db_vendor = (source)

Undocumented

select_on_save: bool = (source)

Undocumented

swappable = (source)

Undocumented

unique_together = (source)

Undocumented

verbose_name = (source)

Undocumented

verbose_name_plural = (source)

Undocumented

Undocumented

Undocumented

Return a list of all concrete fields on the model and its parents. Private API intended only to be used by Django itself; get_fields() combined with filtering of field properties is the public API for obtaining this field list.

@cached_property
db_returning_fields = (source)

Private API intended only to be used by Django itself. Fields to be returned after a database insert.

Undocumented

Return a list of all forward fields on the model and its parents, excluding ManyToManyFields. Private API intended only to be used by Django itself; get_fields() combined with filtering of field properties is the public API for obtaining this field list.

Undocumented

Undocumented

@property
label_lower = (source)

Undocumented

@cached_property
local_concrete_fields = (source)

Return a list of all concrete fields on the model. Private API intended only to be used by Django itself; get_fields() combined with filtering of field properties is the public API for obtaining this field list.

Undocumented

Undocumented

Return a list of all many to many fields on the model and its parents. Private API intended only to be used by Django itself; get_fields() combined with filtering of field properties is the public API for obtaining this list.

Return all related objects pointing to the current model. The related objects can come from a one-to-one, one-to-many, or many-to-many field relation type. Private API intended only to be used by Django itself; get_fields() combined with filtering of field properties is the public API for obtaining this field list.

Has this model been swapped out for another? If so, return the model name of the replacement; otherwise, return None. For historical reasons, model name lookups using get_model() are case insensitive, so we make sure we are case insensitive here.

@cached_property
total_unique_constraints = (source)

Return a list of total unique constraints. Useful for determining set of fields guaranteed to be unique for all rows.

@property
verbose_name_raw = (source)

Return the untranslated verbose name.

def _expire_cache(self, forward=True, reverse=True): (source)

Undocumented

def _format_names_with_class(self, cls, objs): (source)

App label/class name interpolation for object names.

def _get_default_pk_class(self): (source)

Undocumented

def _get_fields(self, forward=True, reverse=True, include_parents=True, include_hidden=False, seen_models=None): (source)

Internal helper function to return fields of the model. * If forward=True, then fields defined on this model are returned. * If reverse=True, then relations pointing to this model are returned. * If include_hidden=True, then fields with is_hidden=True are returned. * The include_parents argument toggles if fields from parent models should be included. It has three values: True, False, and PROXY_PARENTS. When set to PROXY_PARENTS, the call will return all fields defined for the current model or any of its parents in the parent chain to the model's concrete model.

def _populate_directed_relation_graph(self): (source)

This method is used by each model to find its reverse objects. As this method is very expensive and is accessed frequently (it looks up every field in a model, in every app), it is computed on first access and then is set as a property on every model.

def _prepare(self, model): (source)

Undocumented

_get_fields_cache: dict = (source)

Undocumented

_ordering_clash = (source)

Undocumented

@cached_property
_forward_fields_map = (source)

Undocumented

Return a set of the names of the properties defined on the model.

Undocumented