标签:creat sha publish lte png print 反向 mail last
from django.shortcuts import render,HttpResponse from app01 import models # Create your views here. def query(request): # ###############基于对象查询(子查询)############## # 一对多查询 book-->publish #正向查询: # 查询python这本书的出版社的email邮箱. python_obj = models.Book.objects.filter(title =‘python‘).first() print(python_obj.publish.email) return HttpResponse(‘ OK‘)
# ###############基于对象查询(子查询)##############
# 正向查询按字段查询
# 一对多查询 book----------------------->publish
# <----------------------
#反向查询 book_set.all()
反向查询
反向查询#查询五道口出版社的书籍名称 pub_obj =models.Publish.objects.filter(name =‘五道口出版社‘).last()
for obj in pub_obj.book_set.all():
print(obj.title)
return HttpResponse(‘ OK‘)
标签:creat sha publish lte png print 反向 mail last
原文地址:https://www.cnblogs.com/mengbin0546/p/9125358.html