📅  最后修改于: 2022-03-11 14:45:29.225000             🧑  作者: Mango
# models.py
from django.db import models
from taggit.managers import TaggableManager
class MyObject(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
tags = TaggableManager()
#template.html
{% for object in objects %}
{{ object.title }}
{{ object.content }}
{% for tag in object.tags.all %}
- {{ tag.name }}
{% endfor %}
{% endfor %}