详情功能的实现
def detail(request, sid):
stu = Student.objects.get(sid=sid)
return render(request, 'detail.html', {'stu': stu})
detail.html文件内容:
{% load static %}
<!DOCTYPE html>
{# 显示学生具体信息 stu已传过来了#}
{ { stu.name }}
{ { stu.age }}
{ { stu.sex }}
{ { stu.date|date:'Y年m月d日' }}
{ { stu.score01 }}
{ { stu.score02 }}
{ { stu.score03 }}
{ { stu_score }}
{# 删除按钮 点击后跳转到del 还要传id号#}
{# 首页按钮 点击后跳转到index#}