INSTALLATION AND USAGE

  1. Put 'tagsfield' directory somewhere on Python path

  2. Include 'tagsfield' in INSTALLED_APPS

  3. Install necessary db tables using ./manage.py syncdb

  4. Copy (or link) 'media' directory under your MEDIAROOT, where it can be accessed over HTTP under MEDIAURL.

Then you can use tags in your models:

from tagsfield.models import Tag
from tagsfield import fields

class Article(models.Model):
    ...
    tags = fields.TagsField(Tag)

Now you can use the field "tags" the same as the default ManyToManyField. The only difference is that in forms created for the model tags will be displayed as a set of autocomplete widgets (see. included demo.html). In order for these widgets to actually work you should include on the page necessary scripts and styles:

<head>
...
{{ form.media }}
...
</head>

The field will also work in admin and for this you don't need to manually include media on a page since admin already does it for you.

Tags are usually stored in the library's built-in Tag model. They are used for auto-completion in forms. You can use your own models instead but make sure that it meets the following requirements:

SETTINGS

There's one optional setting:

TAGS_URL : URL to the "tag's page" on your site (if you plan to have one). Usually it shows a list of objects that are linked to a certain tag. The setting should be in the form of 'http://domain/path/%s/' where %s is replaced with tag's value. If not set then tags are displayed without links at all.