Fabulous Tagging for Django
Project description
Django Tagulous - Fabulous Tags
A tagging library for Django. Built on ForeignKey and ManyToManyField to support tag strings as well as native ORM queries.
Use a SingleTagField
as a CharField with dynamic choices, or a TagField
for
conventional tagging or nested categorisation.
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 fields on a single model
- Supports trees of nested tags, for detailed categorisation
- Admin support for managing tags and tagged models
Supports Django 3.2+, on Python 3.10+.
See the Documentation for details of how Tagulous works; in particular:
- Installation - how to install Tagulous
- Example Usage - see examples of Tagulous in use
- Upgrading - how to upgrade Tagulous, and see what has changed in the changelog
- Contributing - for how to contribute to Tagulous
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
from tagulous.models import SingleTagField, TagField
class Person(models.Model):
name = models.CharField(max_length=255)
title = SingleTagField(initial="Mr, Mrs, Miss, Ms")
skills = 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 each tag field is a ForeignKey
or ManyToManyField
relationship to
a separate model (by default), so 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_tagulous-2.1.0.tar.gz
.
File metadata
- Download URL: django_tagulous-2.1.0.tar.gz
- Upload date:
- Size: 291.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f629b54ad720052092785b0dce056dc6a68c7b63f8126075af9c25848b250bfd |
|
MD5 | b8a86a7a917eb081dbb95f0d898f1a4e |
|
BLAKE2b-256 | 5d97f9a157716e3ce00b9d0ae596d9452bc6bb993066337a885a94c96ac7169c |
File details
Details for the file django_tagulous-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_tagulous-2.1.0-py3-none-any.whl
- Upload date:
- Size: 286.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ebba5a51f049f6df5f9d2a30eef431c0bf7cd35758aa0a42fc3351be4d239cd |
|
MD5 | 60cc7a4ec168f0116d10f733fa328794 |
|
BLAKE2b-256 | dd7b14c1c0a8e5378ccebe906676084ada7c7679ad76659a44cb5a55413ba5bc |