Giter VIP home page Giter VIP logo

django-tagulous's Introduction

Django Tagulous - Fabulous Tags

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

PyPI Documentation Status Tests Test coverage

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 2.2+, on Python 3.6+.

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
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 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.

django-tagulous's People

Contributors

4levels avatar bopeng avatar dubirajara avatar frlan avatar gutard avatar ipmb avatar ivanchenkodmitry avatar jedie avatar jpic avatar marxide avatar mcrot avatar poolpoolpoolpool avatar radiac avatar rerb avatar rgaiacs avatar valentijnscholten avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.