diff --git a/courses/views.py b/courses/views.py index 0d65036..54023b3 100755 --- a/courses/views.py +++ b/courses/views.py @@ -46,7 +46,10 @@ def course(request, slug): check_journal(journal) _map = CourseMap.objects.filter(course=course).order_by('sort').first() _j = _map.get_obj() - j = HomeworkJ.objects.get(material=_j, student=request.user) + if _map._type == 'H': + j = HomeworkJ.objects.get(material=_j, student=request.user) + if _map._type == 'L': + j = LessonJ.objects.get(material=_j, student=request.user) j.open_material() else: journal, created = TeacherJ.objects.get_or_create(course=course, student=user_fabric(request.user)) @@ -59,11 +62,12 @@ def course(request, slug): start_flow = None if request.user.is_authenticated() and not request.user.is_admin: try: - bill = Bill.objects.get( + bills = Bill.objects.filter( service__course=course, user=request.user, status='F') - if bill.flow: - flow = bill.flow.get_status() - start_flow = bill.flow.start_flow + for bill in bills: + if bill.flow: + flow = bill.flow.get_status() + start_flow = bill.flow.start_flow except Bill.DoesNotExist: pass