假设有一个包含所有要搜索的键的列表,称为taglist。要过滤所有 Post contains tag in taglist,我使用以下命令。
Post.objects.filter(tags__tag__in=taglist).order_by('-id')并在 class Post
tags = models.ManyToManyField('PostMention')在 PostMenthion
class PostMention(models.Model): tag = models.CharField(unique=True,max_length=200)
我会得到一个关于结果的查询列表。
我可以获得像这样的元组列表(each_result,tag_that_used_to_found_the_result)吗?
慕容3067478
慕容708150
随时随地看视频慕课网APP
相关分类