Getting StartedΒΆ

Install using pip:

pip install django-prefetch-utils

Add django_prefetch_utils to your INSTALLED_APPS setting:

INSTALLED_APPS = [
   "django_prefetch_utils",
   ...
]

To use the identity map prefetch_related_objects implementation globally, provide the PREFETCH_UTILS_DEFAULT_IMPLEMENTATION setting:

PREFETCH_UTILS_DEFAULT_IMPLEMENTATION = (
    'django_prefetch_utils.identity_map.prefetch_related_objects'
)

See Identity Map Usage for more ways to use this library.