class documentation

class ManyToOneRel(ForeignObjectRel):

Known subclasses: django.db.models.fields.reverse_related.OneToOneRel

View In Hierarchy

Used by the ForeignKey field to store information about the relation.

_meta.get_fields() returns this class to provide access to the field flags for the reverse relation.

Note: Because we somewhat abuse the Rel objects by using them as reverse fields we get the funny situation where ManyToOneRel.many_to_one == False and ManyToOneRel.one_to_many == True. This is unfortunate but the actual ManyToOneRel class is a private API and there is work underway to turn reverse relations into actual fields.

Method __getstate__ Undocumented
Method __init__ Undocumented
Method get​_related​_field Return the Field in the 'to' object to which this relationship is tied.
Method set​_field​_name Set the related field's name, this is not available until later stages of app loading, so set_field_name is called from set_attributes_from_rel()
Instance Variable field​_name Undocumented
Property identity Undocumented

Inherited from ForeignObjectRel:

Method __eq__ Undocumented
Method __hash__ Undocumented
Method __repr__ Undocumented
Method get​_accessor​_name Undocumented
Method get​_cache​_name Return the name of the cache key to use for storing an instance of the forward model on the reverse model.
Method get​_choices Return choices with a default blank choices included, for use as <select> choices for this field.
Method get​_extra​_restriction Undocumented
Method get​_internal​_type Undocumented
Method get​_joining​_columns Undocumented
Method get​_lookup Undocumented
Method get​_path​_info Undocumented
Method is​_hidden Should the related object be hidden?
Class Variable auto​_created Undocumented
Class Variable concrete Undocumented
Class Variable editable Undocumented
Class Variable empty​_strings​_allowed Undocumented
Class Variable is​_relation Undocumented
Class Variable null Undocumented
Instance Variable field Undocumented
Instance Variable limit​_choices​_to Undocumented
Instance Variable model Undocumented
Instance Variable multiple Undocumented
Instance Variable on​_delete Undocumented
Instance Variable parent​_link Undocumented
Instance Variable related​_name Undocumented
Instance Variable related​_query​_name Undocumented
Instance Variable symmetrical Undocumented
Property db​_type Undocumented
Property hidden Undocumented
Property many​_to​_many Undocumented
Property many​_to​_one Undocumented
Property name Undocumented
Property one​_to​_many Undocumented
Property one​_to​_one Undocumented
Property related​_model Undocumented
Property remote​_field Undocumented
Property target​_field When filtering against this relation, return the field on the remote model against which the filtering should happen.

Inherited from FieldCacheMixin (via ForeignObjectRel):

Method delete​_cached​_value Undocumented
Method get​_cached​_value Undocumented
Method is​_cached Undocumented
Method set​_cached​_value Undocumented
def __getstate__(self):

Undocumented

def __init__(self, field, to, field_name, related_name=None, related_query_name=None, limit_choices_to=None, parent_link=False, on_delete=None):
def get_related_field(self):
Return the Field in the 'to' object to which this relationship is tied.
def set_field_name(self):
Set the related field's name, this is not available until later stages of app loading, so set_field_name is called from set_attributes_from_rel()