这里写自定义目录标题
模型类
还是上节课的Clazz1和Student4
重写返回值,显示姓名和成绩
def __str__(self):
return 'Student4:%s %s' % (self.sname, self.score)
用sql的select语言
raw原生全查询
raw查询只适合select all 全选
from stu.models import *
stus = Student4.objects.raw('select * from stu_student4')
print(stus)
<RawQuerySet: select * from stu_student4>
for s in stus: