本文整理匯總了Python中enroll.models.Student.list_for_course_enrolled方法的典型用法代碼示例。如果您正苦於以下問題:Python Student.list_for_course_enrolled方法的具體用法?Python Student.list_for_course_enrolled怎麽用?Python Student.list_for_course_enrolled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類enroll.models.Student
的用法示例。
在下文中一共展示了Student.list_for_course_enrolled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: course_backup
# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import list_for_course_enrolled [as 別名]
def course_backup(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)
student_list_to_enroll=Student.list_for_course_to_enroll(course.key())
student_list_enrolled=Student.list_for_course_enrolled(course.key())
if course.group_mode == 'Single':
student_list_to_enroll = sort_students_spare_single(student_list_to_enroll)
student_list_enrolled = sort_students_single(student_list_enrolled)
elif course.group_mode == 'School':
student_list_to_enroll = sort_students_spare_school(student_list_to_enroll)
student_list_enrolled = sort_students_school(student_list_enrolled)
elif course.group_mode == 'Pair':
student_list_to_enroll = sort_students_spare_pair(student_list_to_enroll)
student_list_enrolled = sort_students_pair(student_list_enrolled)
students = []
students.extend(student_list_enrolled)
students.extend(student_list_to_enroll)
data = [ ['#zaloha kurz',course.code,course.folder_name(),course.season_name()]]
for s in students:
if not s.x_pair_empty_slot:
data.append(s.as_csv_row())
out = cStringIO.StringIO()
dump_to_csv(data,out)
# logging.info(out)
cb = CourseBackup()
cb.init(out.getvalue(),course=course)
cb.save()
course.mark_as_backup()
course.save()
if cfg.getConfigBool('BACKUP_EMAIL_ON',False):
taskqueue.add(url='/task/send_backup/', params={'coursebackup_id':cb.key().id()})
logging.info('send task plan ok, cbid=%s'%(cb.key().id()))
else:
logging.info('BACKUP_EMAIL_ON is OFF!')
return HttpResponse('ok')