class documentation

class Options:

View In Hierarchy

Undocumented

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:
Constant FORWARD​_PROPERTIES Undocumented
Constant REVERSE​_PROPERTIES Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
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 No summary
Method ​_populate​_directed​_relation​_graph No summary
Method ​_prepare 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 No summary
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​_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".
Instance Variable ​_get​_fields​_cache Undocumented
Instance Variable ​_ordering​_clash 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 ​_forward​_fields​_map Undocumented
Property ​_property​_names Return a set of the names of the properties defined on the model.
Property ​_relation​_tree 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 installed 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.
def get_field(self, field_name):
Return a field instance given the name of a forward or reverse field.
def get_fields(self, include_parents=True, include_hidden=False):

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 "+"
FORWARD_PROPERTIES: set[str] =

Undocumented

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

Undocumented

Value
set(['related_objects', 'fields_map', '_relation_tree'])
def __init__(self, meta, app_label=None):

Undocumented

def __repr__(self):

Undocumented

def __str__(self):

Undocumented

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

Undocumented

def _format_names_with_class(self, cls, objs):
App label/class name interpolation for object names.
def _get_default_pk_class(self):

Undocumented

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

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

Undocumented

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

Undocumented

def add_manager(self, manager):

Undocumented

def can_migrate(self, connection):
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):

Undocumented

def get_ancestor_link(self, ancestor):

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):
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_parent_list(self):
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):
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):
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):

Undocumented

def setup_proxy(self, target):
Do the internal setup so that the current model is a proxy for "target".
_get_fields_cache: dict =

Undocumented

_ordering_clash =

Undocumented

abstract: bool =

Undocumented

app_label =

Undocumented

apps =

Undocumented

auto_created: bool =

Undocumented

auto_field =

Undocumented

base_manager_name =

Undocumented

concrete_model =

Undocumented

constraints: list =

Undocumented

db_table =

Undocumented

db_tablespace =

Undocumented

default_manager_name =

Undocumented

default_permissions: tuple[str, ...] =

Undocumented

default_related_name =

Undocumented

get_latest_by =

Undocumented

index_together =

Undocumented

indexes: list =

Undocumented

local_fields: list =

Undocumented

local_managers: list =

Undocumented

local_many_to_many: list =

Undocumented

managed: bool =

Undocumented

meta =

Undocumented

model =

Undocumented

model_name =

Undocumented

object_name =

Undocumented

order_with_respect_to =

Undocumented

ordering: tuple[str, ...] =

Undocumented

original_attrs: dict =

Undocumented

parents: dict =

Undocumented

permissions: list =

Undocumented

pk =

Undocumented

private_fields: list =

Undocumented

proxy: bool =

Undocumented

proxy_for_model =

Undocumented

related_fkey_lookups: list =

Undocumented

required_db_features: list =

Undocumented

required_db_vendor =

Undocumented

select_on_save: bool =

Undocumented

swappable =

Undocumented

unique_together =

Undocumented

verbose_name =

Undocumented

verbose_name_plural =

Undocumented

@cached_property
_forward_fields_map =

Undocumented

@cached_property
_property_names =
Return a set of the names of the properties defined on the model.
@cached_property
_relation_tree =

Undocumented

@property
app_config =

Undocumented

@cached_property
base_manager =

Undocumented

@cached_property
concrete_fields =

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 =
Private API intended only to be used by Django itself. Fields to be returned after a database insert.
@cached_property
default_manager =

Undocumented

@cached_property
fields =

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.

@cached_property
fields_map =

Undocumented

@property
installed =

Undocumented

@property
label =

Undocumented

@property
label_lower =

Undocumented

@cached_property
local_concrete_fields =

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.

@cached_property
managers =

Undocumented

@cached_property
managers_map =

Undocumented

@cached_property
many_to_many =

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.

@cached_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.

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.

@property
swapped =

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 =
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.