django-taggit is a reusable Django application for simple, yet powerful, tagging. It provides a `TaggableManager` to easily add tags to any Django model. The current version is 6.1.0, and it maintains an active development and release cadence, supporting modern Django and Python versions.
pip install django-taggitVerified import paths — ran on the pinned version, not inferred.
To quickly integrate `django-taggit`, install it, add 'taggit' to your `INSTALLED_APPS`, run migrations, and then add a `TaggableManager` field to your Django model. This example demonstrates basic model creation, tag assignment, filtering, and tag removal.
Ensure your project uses Python 3.9 or newer. Downgrade `django-taggit` to a 5.x version if Python 3.8 support is critical.
If you relied on the previous unordered behavior or a specific custom ordering, you can explicitly set `ordering=[]` on your `TaggableManager` instance: `tags = TaggableManager(ordering=[])`.
To enable case-insensitive tag lookups, add `TAGGIT_CASE_INSENSITIVE = True` to your Django `settings.py` file. This setting is `False` by default.
You often need to implement custom serializer fields or methods (e.g., `TagListSerializerField` from `taggit.serializers` or custom `serializers.SlugRelatedField`) to correctly handle tag input and output with DRF.
When installing, always pin `django-taggit` to a compatible version for your Django installation (e.g., `pip install 'django-taggit<5'` for older Django) or ensure `Django` itself is pinned to avoid unexpected upgrades. This was fixed in `5.0.1`.
Remove `'taggit'` from `INSTALLED_APPS` if you are providing your own custom tag models and ensure your custom models are correctly configured according to the 'Customizing taggit' documentation.