當前位置: 首頁>>代碼示例>>Python>>正文


Python Student.list_for_course方法代碼示例

本文整理匯總了Python中enroll.models.Student.list_for_course方法的典型用法代碼示例。如果您正苦於以下問題:Python Student.list_for_course方法的具體用法?Python Student.list_for_course怎麽用?Python Student.list_for_course使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在enroll.models.Student的用法示例。


在下文中一共展示了Student.list_for_course方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: course_fullsync

# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import list_for_course [as 別名]
def course_fullsync(request):
    logging.info(request.POST)
    course_id = request.POST['course_id']
    course = Course.get_by_id(int(course_id))
    if course is None:
        raise Http404 
    cdbsync.plan_cdb_put(course)
    logging.info('course=%s'%course)
    students = Student.list_for_course(course.key())
    for s in students:
        logging.info("student %s" % s.key())
        cdbsync.plan_cdb_put(s)
    logging.info("all done")
    return HttpResponse('ok')
開發者ID:,項目名稱:,代碼行數:16,代碼來源:

示例2: update_all_students_for_course

# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import list_for_course [as 別名]
def update_all_students_for_course(request):
    logging.info(request.POST)
    course_id = request.POST['course_id']
    course = Course.get_by_id(int(course_id))
    if course is None:
        raise Http404 
    logging.info('course=%s'%course)
    cdbsync.plan_cdb_put(course)
    students = Student.list_for_course(course.key())
    for s in students:
        logging.info("student %s" % s.key())
        taskqueue.add(url='/task/update_all_students_do_one/', params={'student_key':s.key()})
 
    logging.info("all done")
    return HttpResponse('ok')
開發者ID:,項目名稱:,代碼行數:17,代碼來源:

示例3: hide_course_students

# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import list_for_course [as 別名]
def hide_course_students(request):
    logging.info(request.POST)
    course_id = request.POST['course_id']
    course = Course.get_by_id(int(course_id))
    
    if course is None:
        raise Http404
 
    list = Student.list_for_course(course.key())
    for s in list:
        s.hidden = True
        s.save()
        cdbsync.plan_cdb_put(s)


    course.mark_as_modify()
    course.save()
    cdbsync.plan_cdb_put(course)

 
    return HttpResponse('ok')
開發者ID:,項目名稱:,代碼行數:23,代碼來源:

示例4: recount_course_capacity

# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import list_for_course [as 別名]
def recount_course_capacity(course):
   
    if course is None:
        raise Http404

    pending = 0
    pending_m = 0
    pending_f = 0
    enrolled = 0
    enrolled_m = 0
    enrolled_f = 0

    unconf = 0
    unconf_m = 0
    unconf_f = 0


    enrolled_paid = 0

    stat_fp_m = 0
    stat_pp_m = 0
    stat_np_m = 0

    stat_fp_f = 0
    stat_pp_f = 0
    stat_np_f = 0


    list = Student.list_for_course(course.key())
    for s in list:
        m = False
        f = False
        if s.addressing == 'p':
            m=True
        elif s.addressing == 's' or s.addressing == 'd':
            f=True

        if s.status == 's':
            pending+=1
            if m:
                pending_m+=1
            if f:
                pending_f+=1
        elif s.status == 'n':
            unconf+=1
            if m:
                unconf_m+=1
            if f:
                unconf_f+=1
             
        elif s.status == 'e':
            if not s.paid is None:
                enrolled_paid+=s.paid

            enrolled+=1
            if m:
                enrolled_m+=1
            if f:
                enrolled_f+=1
 
            if s.is_fp():
                if m:
                    stat_fp_m+=1   
                if f:
                    stat_fp_f+=1   
            elif s.is_pp():
                if m:
                    stat_pp_m+=1   
                if f:
                    stat_pp_f+=1   
            elif s.is_np():
                if m:
                    stat_np_m+=1   
                if f:
                    stat_np_f+=1   
 
 


    course.pending=pending
    course.usage=enrolled
    course.unconf=unconf

    course.stat_e_m = enrolled_m
    course.stat_s_m = pending_m
    course.stat_e_f = enrolled_f
    course.stat_s_f = pending_f
    course.stat_paid = enrolled_paid
    
    course.stat_fp_m = stat_fp_m
    course.stat_pp_m = stat_pp_m
    course.stat_np_m = stat_np_m

    course.stat_fp_f = stat_fp_f
    course.stat_pp_f = stat_pp_f
    course.stat_np_f = stat_np_f




#.........這裏部分代碼省略.........
開發者ID:,項目名稱:,代碼行數:103,代碼來源:


注:本文中的enroll.models.Student.list_for_course方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。