9 ORM-高阶补充(未完成)

时间:2024-12-25 10:07:02

https://www.cnblogs.com/alice-bj/p/9195846.html#_labelTop

https://www.cnblogs.com/yuanchenqi/articles/7570003.html

9 ORM-高阶补充(未完成)

Queryset:

    切片操作   Book.objects.all()[:]
迭代操作
for obj in Book.objects.all():
print(obj.属性) 惰性查询
ret=Book.objects.all() # for i in ret:
# print(i)
#
# Book.objects.create(title="java",publishDate="2012-12-12",price=,publish_id=)
#
# for i in ret:
# print(i) 缓存机制 # ret=Book.objects.all().exists()
# if ret:
# print("OK") # ret=Book.objects.all().iterator()
# print(type(ret))
# for i in ret:
# print(i)
# Book.objects.create(title="hello2",publishDate="2012-12-12",price=,publish_id=)
#
# for i in ret:
# print(i)

9 ORM-高阶补充(未完成)