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

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

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

 

 

Queryset:

   1 切片操作   Book.objects.all()[0:8]
   2 迭代操作   
         for obj in Book.objects.all():
             print(obj.属性)
             
   3 惰性查询
        ret=Book.objects.all()

        # for i in ret:
        #     print(i)
        #
        # Book.objects.create(title="java",publishDate="2012-12-12",price=12,publish_id=1)
        #
        # for i in ret:
        #     print(i)
      
   4 缓存机制
   
        # 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=12,publish_id=1)
        #
        # for i in ret:
        #     print(i)
   

 

 

 

 

posted @ 2018-08-17 00:32  venicid  阅读(134)  评论(0编辑  收藏  举报