Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DESCRIPTION.rst 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. django-taggit
  2. =============
  3. .. image:: https://travis-ci.org/alex/django-taggit.svg?branch=master
  4. :target: https://travis-ci.org/alex/django-taggit
  5. .. image:: https://codecov.io/gh/alex/django-taggit/coverage.svg?branch=master
  6. :target: https://codecov.io/gh/alex/django-taggit?branch=master
  7. ``django-taggit`` a simpler approach to tagging with Django. Add ``"taggit"`` to your
  8. ``INSTALLED_APPS`` then just add a TaggableManager to your model and go:
  9. .. code:: python
  10. from django.db import models
  11. from taggit.managers import TaggableManager
  12. class Food(models.Model):
  13. # ... fields here
  14. tags = TaggableManager()
  15. Then you can use the API like so:
  16. .. code:: python
  17. >>> apple = Food.objects.create(name="apple")
  18. >>> apple.tags.add("red", "green", "delicious")
  19. >>> apple.tags.all()
  20. [<Tag: red>, <Tag: green>, <Tag: delicious>]
  21. >>> apple.tags.remove("green")
  22. >>> apple.tags.all()
  23. [<Tag: red>, <Tag: delicious>]
  24. >>> Food.objects.filter(tags__name__in=["red"])
  25. [<Food: apple>, <Food: cherry>]
  26. Tags will show up for you automatically in forms and the admin.
  27. ``django-taggit`` requires Django 1.11 or greater.
  28. For more info check out the `documentation <https://django-taggit.readthedocs.io/en/latest/>`_. And for questions about usage or
  29. development you can contact the
  30. `mailinglist <http://groups.google.com/group/django-taggit>`_.