• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

django_taggit.egg-info/H03-May-2022-10076

docs/H05-Jul-2021-568395

taggit/H05-Jul-2021-2,7862,230

tests/H05-Jul-2021-3,5552,976

AUTHORSH A D05-Jul-2021618 2117

CHANGELOG.rstH A D05-Jul-202110.2 KiB387272

LICENSEH A D05-Jul-20211.5 KiB2822

MANIFEST.inH A D05-Jul-2021201 98

PKG-INFOH A D05-Jul-20213.3 KiB10076

README.rstH A D05-Jul-20212.1 KiB6645

setup.cfgH A D05-Jul-20211.3 KiB5245

setup.pyH A D05-Jul-202138 42

tox.iniH A D05-Jul-20211 KiB5649

README.rst

1django-taggit
2=============
3
4.. image:: https://jazzband.co/static/img/badge.svg
5   :target: https://jazzband.co/
6   :alt: Jazzband
7
8.. image:: https://img.shields.io/pypi/pyversions/django-taggit.svg
9   :target: https://pypi.org/project/django-taggit/
10   :alt: Supported Python versions
11
12.. image:: https://img.shields.io/pypi/djversions/django-taggit.svg
13   :target: https://pypi.org/project/django-taggit/
14   :alt: Supported Django versions
15
16.. image:: https://github.com/jazzband/django-taggit/workflows/Test/badge.svg
17   :target: https://github.com/jazzband/django-taggit/actions
18   :alt: GitHub Actions
19
20.. image:: https://codecov.io/gh/jazzband/django-taggit/coverage.svg?branch=master
21    :target: https://codecov.io/gh/jazzband/django-taggit?branch=master
22
23This is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree
24to abide by the `Contributor Code of Conduct
25<https://jazzband.co/about/conduct>`_ and follow the `guidelines
26<https://jazzband.co/about/guidelines>`_.
27
28``django-taggit`` a simpler approach to tagging with Django.  Add ``"taggit"`` to your
29``INSTALLED_APPS`` then just add a TaggableManager to your model and go:
30
31.. code:: python
32
33    from django.db import models
34
35    from taggit.managers import TaggableManager
36
37
38    class Food(models.Model):
39        # ... fields here
40
41        tags = TaggableManager()
42
43
44Then you can use the API like so:
45
46.. code:: pycon
47
48    >>> apple = Food.objects.create(name="apple")
49    >>> apple.tags.add("red", "green", "delicious")
50    >>> apple.tags.all()
51    [<Tag: red>, <Tag: green>, <Tag: delicious>]
52    >>> apple.tags.remove("green")
53    >>> apple.tags.all()
54    [<Tag: red>, <Tag: delicious>]
55    >>> Food.objects.filter(tags__name__in=["red"])
56    [<Food: apple>, <Food: cherry>]
57
58Tags will show up for you automatically in forms and the admin.
59
60``django-taggit`` requires Django 2.2 or greater.
61
62For more info check out the `documentation
63<https://django-taggit.readthedocs.io/>`_. And for questions about usage or
64development you can create an issue on Github (if your question is about
65usage please add the `question` tag).
66