Skip to main content

Fabulous Tagging for Django

Project description

A tagging library for Django built on ForeignKey and ManyToManyField, giving you all their normal power with a sprinkling of tagging syntactic sugar.

https://travis-ci.org/radiac/django-tagulous.svg?branch=master https://coveralls.io/repos/radiac/django-tagulous/badge.svg?branch=master&service=github

Features

  • Easy to install - simple requirements, simple syntax, lots of options

  • Based on ForeignKey and ManyToManyField, so it’s easy to query

  • Autocomplete support built in, if you want it

  • Supports multiple independent tag fields on a single model

  • Can be used as a user-customisable CharField with choices

  • Supports trees of nested tags, for detailed categorisation

  • Admin support for managing tags and tagged models

Supports Django 1.4.2 to 2.2, on Python 2.7 and 3.2 to 3.7.

See the Documentation for details of how Tagulous works; in particular:

Quickstart

Install with pip install django-tagulous, add tagulous to Django’s INSTALLED_APPS and define the serializers, then start adding tag fields to your model:

from django.db import models
import tagulous

class Person(models.Model):
    name = models.CharField(max_length=255)
    title = tagulous.models.SingleTagField(initial="Mr, Mrs, Miss, Ms")
    skills = tagulous.models.TagField()

You can now set and get them using strings, lists or querysets:

myperson = Person.objects.create(name='Bob', title='Mr', skills='run, hop')
# myperson.skills == 'run, hop'
myperson.skills = ['jump', 'kung fu']
myperson.save()
# myperson.skills == 'jump, "kung fu"'
runners = Person.objects.filter(skills='run')

Behind the scenes your tags are stored in separate models (by default), so because the fields are based on ForeignKey and ManyToManyField more complex queries are simple:

qs = MyRelatedModel.objects.filter(
    person__skills__name__in=['run', 'jump'],
)

As well as this you also get autocompletion in public and admin forms, automatic slug generation, unicode support, you can build tag clouds easily, and can nest tags for more complex categorisation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-tagulous-1.0.0.tar.gz (354.4 kB view details)

Uploaded Source

File details

Details for the file django-tagulous-1.0.0.tar.gz.

File metadata

  • Download URL: django-tagulous-1.0.0.tar.gz
  • Upload date:
  • Size: 354.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.0

File hashes

Hashes for django-tagulous-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9b4fa1773845a1cf33d21b27f9cdafc6f3fe29a480428bdd8f8717e7d4742396
MD5 efbea49acbd9f49e111d0fd9a2189c50
BLAKE2b-256 505d2952718d48314e86706628a083f8bab9a1b618149346fdd3710755a5f0c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page