Skip to main content

Machine tagging built upon django-taggit

Project description

https://travis-ci.org/lpomfrey/django-taggit-machinetags.png?branch=master

Overview

This package provides machine tagging (i.e. property:value tagging) built on top of django-taggit.

Installation

Grab from PyPI with:

$ pip install django-taggit-machinetags

Update your installed apps:

INSTALLED_APPS = (
    ...
    'taggit',
    'taggit_machinetags',
    ...
)

And run the migrations:

$ python manage.py migrate

Or if you’re not using south (why are you not using south?):

$ python manage.py syncdb

Usage

Usage is the same as taggit, but tags can now be specified as, colon-separated, property-value pairs.

# models.py
from django.db import models
from taggit_machinetags.managers import MachineTaggableManager

class MyModel(models.Model):

    name = models.CharField(...)
    tags = MachineTaggableManager()

#
>>> instance = MyModel.objects.all()[0]
>>> instance.tags.add('Property:Value')
>>> instance.tags.add('Taggy:McTag')
>>> instance.tags.get(namespace='Property')
<MachineTag: Property:Value>
>> MyModel.objects.filter(tags__slug='taggy:mctag')
<MyModel:...>

Creating a tag with the string ‘Property:Value’ results in a MachineTag with the namespace namespace=Property, name=Value, namespace_slug=property, name_slug=value, and slug=property:value.

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-taggit-machinetags-0.2.1.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file django-taggit-machinetags-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-taggit-machinetags-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1e64fd9a29cecb5cf6b216774eab82beee2bdeeffd7d2baa88c13c9c14de8d6e
MD5 fc14a62f0c362d1e9728151f1dddefcf
BLAKE2b-256 0bf058ae88b85075b8d639008ad511a3c14f7a95b422093559026dc1a218b4a2

See more details on using hashes here.

Provenance

Supported by

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