您的位置:首页 > 博客中心 > 互联网 >

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

时间:2022-05-10 10:00

方式一:

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)

 

本类排行

今日推荐

热门手游