Adding the tagging functionality
A very common functionality in blogs is to categorize posts using tags. Tags allow you to categorize content in a non-hierarchical manner, using simple keywords. A tag is simply a label or keyword that can be assigned to posts. We will create a tagging system by integrating a third-party Django tagging application into the project.
django-taggit is a reusable application that primarily offers you a Tag model and a manager to easily add tags to any model. You can take a look at its source code at https://github.com/jazzband/django-taggit.
…
- First, you need to install
django-taggitviapipby running the following command:
pip install django-taggit==4.0.0
- Then, open the
settings.pyfile of themysiteproject and addtaggitto yourINSTALLED_APPSsetting, as follows:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib...