Skip to main content

Machine tagging built upon django-taggit

Project description

https://badge.fury.io/py/django-taggit-machinetags.png https://travis-ci.org/lpomfrey/django-taggit-machinetags.png?branch=master https://coveralls.io/repos/lpomfrey/django-taggit-machinetags/badge.png?branch=master https://pypip.in/d/django-taggit-machinetags/badge.png

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.5.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

django_taggit_machinetags-0.5.0-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for django-taggit-machinetags-0.5.0.tar.gz
Algorithm Hash digest
SHA256 03edac9709dbf2e1f25b455dfea95e1ad9954f695b0c82a873b3f4340ca46232
MD5 9b48907f8eb189d23912684b5324f41a
BLAKE2b-256 c9877581f51a7e101728a49ffff20522f9ffa66abaecd76a5526018316606184

See more details on using hashes here.

Provenance

File details

Details for the file django_taggit_machinetags-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_taggit_machinetags-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e33f1a2012e6fa5cc2e473ee5778fed944508c794e3ae0f89e84eb891c474eb6
MD5 0e34db202eea3717245420b02e712ec8
BLAKE2b-256 1da01cea9ea94e666df2fd4646524a1e2630f4f780782dcf37896a01a993b69f

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