Skip to content

jazzband/django-taggit

Folders and files

NameName
Last commit message
Last commit date
Jun 19, 2024
Jul 26, 2024
Apr 8, 2022
Jul 28, 2024
Sep 28, 2024
Sep 28, 2024
Aug 25, 2016
Jan 30, 2024
Jul 1, 2024
Oct 26, 2023
Jun 18, 2024
Sep 28, 2024
Nov 3, 2021
Jul 28, 2024
Jun 19, 2021
Aug 12, 2024
Apr 8, 2022
Jul 26, 2024
Nov 17, 2019
Jun 24, 2024

Repository files navigation

django-taggit

Jazzband Supported Python versions Supported Django versions GitHub Actions https://codecov.io/gh/jazzband/django-taggit/coverage.svg?branch=master

This is a Jazzband project. By contributing you agree to abide by the Contributor Code of Conduct and follow the guidelines.

django-taggit a simpler approach to tagging with Django. Add "taggit" to your INSTALLED_APPS then just add a TaggableManager to your model and go:

from django.db import models

from taggit.managers import TaggableManager


class Food(models.Model):
    # ... fields here

    tags = TaggableManager()

Then you can use the API like so:

>>> apple = Food.objects.create(name="apple")
>>> apple.tags.add("red", "green", "delicious")
>>> apple.tags.all()
[<Tag: red>, <Tag: green>, <Tag: delicious>]
>>> apple.tags.remove("green")
>>> apple.tags.all()
[<Tag: red>, <Tag: delicious>]
>>> Food.objects.filter(tags__name__in=["red"])
[<Food: apple>, <Food: cherry>]

Tags will show up for you automatically in forms and the admin.

django-taggit requires Django 3.2 or greater.

For more info check out the documentation. And for questions about usage or development you can create an issue on Github (if your question is about usage please add the question tag).