简介
django-taggit
是一个通用的,易用的标签系统.
from django.db import models
from taggit.managers import TaggableManager
class Food(models.Model):
# ... fields here
tags = TaggableManager()
>>> 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>]
个人评分
实用性 | ⭐️⭐️⭐️ |
易用性 | ⭐️⭐️⭐️⭐️⭐️ |
有趣性 | ⭐️⭐️⭐️ |