class documentation

class GenericForeignKey(FieldCacheMixin): (source)

View In Hierarchy

Provide a generic many-to-one relation through the ``content_type`` and ``object_id`` fields. This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

Method __get__ Undocumented
Method __init__ Undocumented
Method __set__ Undocumented
Method __str__ Undocumented
Method check Undocumented
Method contribute_to_class Undocumented
Method get_cache_name Undocumented
Method get_content_type Undocumented
Method get_filter_kwargs_for_object See corresponding method on Field
Method get_forward_related_filter See corresponding method on RelatedField
Method get_prefetch_queryset Undocumented
Class Variable auto_created Undocumented
Class Variable concrete Undocumented
Class Variable hidden Undocumented
Class Variable is_relation Undocumented
Class Variable many_to_many Undocumented
Class Variable many_to_one Undocumented
Class Variable one_to_many Undocumented
Class Variable one_to_one Undocumented
Class Variable related_model Undocumented
Class Variable remote_field Undocumented
Instance Variable column Undocumented
Instance Variable ct_field Undocumented
Instance Variable editable Undocumented
Instance Variable fk_field Undocumented
Instance Variable for_concrete_model Undocumented
Instance Variable model Undocumented
Instance Variable name Undocumented
Instance Variable rel Undocumented
Method _check_content_type_field Check if field named `field_name` in model `model` exists and is a valid content_type field (is a ForeignKey to ContentType).
Method _check_field_name Undocumented
Method _check_object_id_field Undocumented

Inherited from FieldCacheMixin:

Method delete_cached_value Undocumented
Method get_cached_value Undocumented
Method is_cached Undocumented
Method set_cached_value Undocumented
def __get__(self, instance, cls=None): (source)

Undocumented

def __init__(self, ct_field='content_type', fk_field='object_id', for_concrete_model=True): (source)

Undocumented

def __set__(self, instance, value): (source)

Undocumented

def __str__(self): (source)

Undocumented

def check(self, **kwargs): (source)

Undocumented

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

Undocumented

def get_content_type(self, obj=None, id=None, using=None): (source)

Undocumented

def get_filter_kwargs_for_object(self, obj): (source)

See corresponding method on Field

def get_forward_related_filter(self, obj): (source)

See corresponding method on RelatedField

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

Undocumented

auto_created: bool = (source)

Undocumented

concrete: bool = (source)

Undocumented

Undocumented

is_relation: bool = (source)

Undocumented

many_to_many: bool = (source)

Undocumented

many_to_one: bool = (source)

Undocumented

one_to_many: bool = (source)

Undocumented

one_to_one: bool = (source)

Undocumented

related_model = (source)

Undocumented

remote_field = (source)

Undocumented

Undocumented

ct_field = (source)

Undocumented

editable: bool = (source)

Undocumented

fk_field = (source)

Undocumented

for_concrete_model = (source)

Undocumented

Undocumented

Undocumented

Undocumented

def _check_content_type_field(self): (source)

Check if field named `field_name` in model `model` exists and is a valid content_type field (is a ForeignKey to ContentType).

def _check_field_name(self): (source)

Undocumented

def _check_object_id_field(self): (source)

Undocumented