Esempio n. 1
0
def teacher_detail(request, teacherid):
    if teacherid:
        teacher = TeacherInfo.objects.filter(id=int(teacherid))[0]
        teacher.click_num += 1
        teacher.save()
        sort_teachers = teacher.org.teacherinfo_set.order_by('-love_num')[:2]
        love_statu = get_love_status(request, teacher.org.id, 1)
        love_teastatu = get_love_status(request, teacher.id, 3)
        return render(
            request, 'orgs/teacher-detail.html', {
                'teacher': teacher,
                'sort_teachers': sort_teachers,
                'love_statu': love_statu,
                'love_teastatu': love_teastatu
            })
Esempio n. 2
0
def org_detail_teacher(request, orgid):
    if orgid:
        org = OrgInfo.objects.filter(id=int(orgid))[0]
        love_statu = get_love_status(request, orgid, 1)
        return render(request, 'orgs/org-detail-teachers.html', {
            'org': org,
            'detail_type': 'teacher',
            'love_statu': love_statu
        })
Esempio n. 3
0
def org_detail(request, orgid):
    if orgid:
        org = OrgInfo.objects.filter(id=int(orgid))[0]
        org.click_num += 1
        org.save()
        love_statu = get_love_status(request, orgid, 1)
        return render(request, 'orgs/org-detail-homepage.html', {
            'org': org,
            'detail_type': 'home',
            'love_statu': love_statu
        })
Esempio n. 4
0
def org_detail_course(request, orgid):
    if orgid:
        org = OrgInfo.objects.filter(id=int(orgid))[0]
        all_courses = org.courseinfo_set.all()
        love_statu = get_love_status(request, orgid, 1)
        pa = Paginator(all_courses, 2)
        pagenum = request.GET.get('pagenum', '')
        try:
            pages = pa.page(pagenum)
        except PageNotAnInteger:
            pages = pa.page(1)
        except EmptyPage:
            pages = pa.page(pa.num_pages)
        return render(
            request, 'orgs/org-detail-course.html', {
                'org': org,
                'pages': pages,
                'detail_type': 'course',
                'love_statu': love_statu
            })