django_dbcache_fields.utils

class django_dbcache_fields.utils.Register

Central register to keep track of all dbcache decorated methods.

get(class_path)

Returns a list of information about dbcache decorated methods.

Parameters:class_path – The Model class path.
Returns:
A list of dict with the following keys:
  • decorated_method
  • field
  • field_name
  • dirty_func
  • invalidated_by

Returns a dict of models related to the dbcache decorated method. Typically used to see which models and fields should be invalidated when a related model is changed

Parameters:model – The model name in the form {app label}.{model name}.
Returns:A dict where each key is the affected model class path. The value is a list of field names that are affected.
django_dbcache_fields.utils.get_class_path(instance)

Converts an instance or class to a class path string.

Parameters:instance – An instance or class.
Returns:The stringified class path.
django_dbcache_fields.utils.get_model_name(instance)

Converts a Model instance or class to a model name.

Parameters:instance – A Model instance or class.
Returns:The stringified model name in the form {app label}.{model name}.