When migrating from django-template-partials to Django Core (starting with Django 6.0), follow these steps to remove the library and switch to the built-in functionality. All existing functionality including partialdef, inline partials, and context handling is expected to work with the core implementation.
1. Remove from INSTALLED_APPS
Remove "template_partials" or "template_partials.apps.SimpleAppConfig" from your INSTALLED_APPS setting.
2. Remove Manual TEMPLATES Setting Changes
If you manually configured the template loader or added partials to builtins, remove those configurations:
- Remove
"template_partials.templatetags.partials" from the builtins list in your TEMPLATES setting. - Remove any custom loader configurations, such as
loaders = [("template_partials.loader.Loader", cached_loaders)].
3. Remove Template Tag Loading
Since partials is now a built-in tag in Django Core, you no longer need to load it manually. Remove {% load partials %} from all your templates.
4. Uninstall the Package
Uninstall the package from your environment and remove it from your dependency files (requirements.txt, pyproject.toml, etc.):
pip uninstall django-template-partials
Note: Test your templates thoroughly after migration to ensure compatibility with the Django 6.0 implementation.
# Before migration (example INSTALLED_APPS)
INSTALLED_APPS = [
"template_partials",
"django.contrib.admin",
]
# After migration
INSTALLED_APPS = [
"django.contrib.admin",
]