Add field tags to a Django project
Project description
This is a clone of Jazzband django-taggit project.
By contributing you agree to abide by the Contributor Code of Conduct.
django-tag-fields a simpler approach to tagging with Django. Add "tag_fields" to your INSTALLED_APPS then just add a TaggableManager to your model and go:
from django.db import models
from tag_fields.managers import TaggableManager
class Food(models.Model):
# ... fields here
tags = TaggableManager()
Then you can use the API like so:
>>> apple = Food.objects.create(name="apple")
>>> apple.tags.add("red", "green", "delicious")
>>> apple.tags.all()
[<Tag: red>, <Tag: green>, <Tag: delicious>]
>>> apple.tags.remove("green")
>>> apple.tags.all()
[<Tag: red>, <Tag: delicious>]
>>> Food.objects.filter(tags__name__in=["red"])
[<Food: apple>, <Food: cherry>]
Tags will show up for you automatically in forms and the admin.
django-tag-fields requires Django 3.2 or greater.
For more info check out the documentation.
For questions about usage or development you can create an issue on Github (if your question is about usage please add the question label).
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
Built Distribution
File details
Details for the file django-tag-fields-4.1.0.tar.gz
.
File metadata
- Download URL: django-tag-fields-4.1.0.tar.gz
- Upload date:
- Size: 73.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd7215be50d42ce1ce71e1cb260efdf341f077330c7b5e17d94f53ec61720118 |
|
MD5 | d4a1e905c904cc7ee75825242ba7c1cd |
|
BLAKE2b-256 | f9c559a97f21274f02911a7811fc7ee29caa99562c9f4f723a7d28265b3e4e8f |
File details
Details for the file django_tag_fields-4.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_tag_fields-4.1.0-py3-none-any.whl
- Upload date:
- Size: 59.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f7307739cc71997008567275c993d20eef8d04a1f63b8e07efeb60c0c100bf3 |
|
MD5 | 5cb3a1047ab7ed3b4eebda9bb9d1978d |
|
BLAKE2b-256 | f931fd0c7c785a71acd16c55597c986b66155e9f34386f7251783d645dc36d88 |