radiac/django-tagulous
소개
Fabulous Tagging for Django
웹 및 앱 개발What you can do
- 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
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalDjango 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.
If you find this project useful, please do consider sponsoring development.
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
Tested on Django 3.2 to 6.1, 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 django_tagulous to Django's INSTALLED_APPS
and
define the serializers,
then start adding tag fields to your model:
from django.db import models
from django_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.
관련 프로젝트 살펴보기
불러오는 중…