Commit 5968ac8b by Alex Gaynor

Docs.

parent 268bc3b1
...@@ -2,4 +2,28 @@ django-taggit ...@@ -2,4 +2,28 @@ django-taggit
============= =============
Is a simpler approach to tagging with Django. Just add a TagManager to your Is a simpler approach to tagging with Django. Just add a TagManager to your
model and go. model and go:
from django.db import models
from taggit.manager import TagManager
class Food(models.Model):
# ... fields here
tags = TagManager()
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")
[<Tag: red>, <Tag: delicious>]
>>> Food.objects.filter(tags="red")
[<Food: apple>, <Food: cherry>]
Tags will show up for you automatically in forms and the admin.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment