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)

 

posted @ 2020-04-20 23:09  手可摘星辰。  阅读(131)  评论(0编辑  收藏  举报