apis_core.relations.utils#

Module Contents#

Functions#

is_relation

relation_content_types

relation_match_target

test if a relation points to a target this function should not be cached, because the forward attribute is an annotation that does not seem to be part of the relation, so if cached, method could be called with another forward value and return the wrong result

get_all_relation_subj_and_obj

Return the model classes of any model that is in some way connected to a relation - either as obj or as subj

API#

apis_core.relations.utils.is_relation(ct: django.contrib.contenttypes.models.ContentType) → bool#
apis_core.relations.utils.relation_content_types(subj_model=None, obj_model=None, any_model=None, combination=(None, None)) → set[django.contrib.contenttypes.models.ContentType]#
apis_core.relations.utils.relation_match_target(relation, target: django.contrib.contenttypes.models.ContentType) → bool#

test if a relation points to a target this function should not be cached, because the forward attribute is an annotation that does not seem to be part of the relation, so if cached, method could be called with another forward value and return the wrong result

apis_core.relations.utils.get_all_relation_subj_and_obj() → list[django.contrib.contenttypes.models.ContentType]#

Return the model classes of any model that is in some way connected to a relation - either as obj or as subj

Returns: list[ContentType]: A list of unique ContentTypes for related models.