1.Manager.raw(raw_query, params=None, translations=None) >>> for p in Person.objects.raw('SELECT * FROM myapp_person'): ... print(p) John Smith Jane Jones 这个方法接受一个原始的SQL查询,执行它,并返回一个django.db.models.query.RawQuerySet实例.这个RawQuerySet实例可以像普通的QuerySe…
Django查询SQL语句 # 1 res=models.Book.objects.all() # print(res)#<QuerySet [<Book: Book object>, <Book: Book object>, <Book: Book object>, <Book: Book object>, <Book: Book object>, <Book: Book object>]> #2 res=models.…