From af41ee65633db100921b196533783f168149f9ac Mon Sep 17 00:00:00 2001 From: Mikhail Bortnikov Date: Wed, 12 Jul 2017 15:54:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=83?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=B0=20+=20=D1=81=D1=87=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=20=D1=81=20=D0=BF=D0=BE=D1=82=D0=BE=D0=BA=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- courses/views.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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