Django Taggit: Model Tag, Admin and Filtering

Adi Ramadhan
3 min readJun 24, 2022


Django Taggit, model tag, registered in admin, and filtering, with bootstrap.
Official docs django-taggit.

filter by tag

Project structure. templates folder, base.html, articles.html, myapp/ files are manually created, other files are auto-generated.

project structure

Step 1: Preparation, Create Django Project
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django and django-taggit in virtualenv:
pip install django==3.2 django-taggit
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject

Step 2: Create Django Apps and Register Django-taggit
Create apps: python startapp myapp
Add myapp and taggit to INSTALLED_APPS in myproject/

INSTALLED_APPS in myproject/

Step 3: Add Model with Tags


Step 4: Register Model in Django Admin


Step 5: Makemigrations and Migrate
Make migrations: python makemigrations
Migrate: python migrate

Step 6: Create Superuser
Create superuser: python createsuperuser
Type username, email password and retype password

Step 7: Run Server and Add Some Data
Run Server: python runserver
Login with superuser and add some data

article list in admin

Step 8: Set up Templates Folder
Create folder templates in myapp

Add template directory in TEMPLATES parameter in myproject/

Path(BASE_DIR, 'myapp', 'templates'),

Step 9: Create HTML Files in myapp/templates Folder

Create bootstrap base template, template/base.html


Create template/articles.html


Step 10: Create View in myapp/


Step 11: Setup URLs in myapp and myproject Folder

Create myapp/


Update myproject/


Step 12: Run Server and Test
Run Server: python runserver