django写的。在点击查询后会显示查询到的数据。但是现在点击查询后并没有数据。有大佬知道怎么解决吗? 10
django框架写的。本来在点击查询后会显示查询到的数据(效果如图四)。但是现在点击查询后,并没有数据(图三)。有大佬知道怎么解决吗?网页代码是第一张图。views部分代...
django框架写的。本来在点击查询后会显示查询到的数据(效果如图四)。但是现在点击查询后,并没有数据(图三)。有大佬知道怎么解决吗?网页代码是第一张图。views部分代码。def select(request): if request.method == "POST": id = request.POST.get('id') stu_data = StudentInfo.objects.get(stu_id=id) stu_id = stu_data.stu_id stu_name = stu_data.stu_name stu_phone = stu_data.stu_phone stu_addr = stu_data.stu_addr stu_faculty = stu_data.stu_faculty stu_major = stu_data.stu_major stu_class = stu_data.stu_class stu_course = StudentGrade.objects.filter(stu_id=id) dct = {} for stu in stu_course: dct[stu.cour_name] = stu.cour_grade context = { 'stu_id': stu_id, 'stu_name': stu_name, 'stu_phone': stu_phone, 'stu_addr': stu_addr, 'stu_faculty': stu_faculty, 'stu_major': stu_major, 'stu_class': stu_class, 'course_data': dct, 'msg': True } return render(request,'studentmanage/查询.html',context) else: id = request.POST.get('id') stu_id = id context = { 'msg': False, 'stu_id': stu_id } return render(request, 'studentmanage/查询.html', context)
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询