class documentation

class ReverseOneToOneDescriptor:

View In Hierarchy

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

Method __get__ Get the related instance through the reverse relation.
Method __init__ Undocumented
Method __reduce__ Undocumented
Method __set__ Set the related instance through the reverse relation.
Method get​_prefetch​_queryset Undocumented
Method get​_queryset Undocumented
Method is​_cached Undocumented
Instance Variable related Undocumented
Property ​Related​Object​Does​Not​Exist Undocumented
def __get__(self, instance, cls=None):

Get the related instance through the reverse relation.

With the example above, when getting place.restaurant:

  • self is the descriptor managing the restaurant attribute
  • instance is the place instance
  • cls is the Place class (unused)

Keep in mind that Restaurant holds the foreign key to Place.

def __init__(self, related):

Undocumented

def __reduce__(self):

Undocumented

def __set__(self, instance, value):

Set the related instance through the reverse relation.

With the example above, when setting place.restaurant = restaurant:

  • self is the descriptor managing the restaurant attribute
  • instance is the place instance
  • value is the restaurant instance on the right of the equal sign

Keep in mind that Restaurant holds the foreign key to Place.

def get_prefetch_queryset(self, instances, queryset=None):

Undocumented

def get_queryset(self, **hints):

Undocumented

def is_cached(self, instance):

Undocumented

related =

Undocumented

@cached_property
RelatedObjectDoesNotExist =

Undocumented