Django_基于双下划线的——连续跨表查询

方式一:

ret = models.Book.objects.filter(authors__authordetail__telephone="123412351").values("title", "publish__name")
print(ret)

方式二:

ret = models.Author.objects.filter(authordetail__telephone="123412351").values("book__title", "book__publish__name")
print(ret)

相关推荐