本文整理汇总了Python中oasis.lib.Users2.get_courses方法的典型用法代码示例。如果您正苦于以下问题:Python Users2.get_courses方法的具体用法?Python Users2.get_courses怎么用?Python Users2.get_courses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.Users2
的用法示例。
在下文中一共展示了Users2.get_courses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_myprofile
# 需要导入模块: from oasis.lib import Users2 [as 别名]
# 或者: from oasis.lib.Users2 import get_courses [as 别名]
def setup_myprofile():
""" Show an account summary for the current user account. """
user_id = session['user_id']
user = Users2.get_user(user_id)
course_ids = Users2.get_courses(user_id)
courses = []
for course_id in course_ids:
courses.append(Courses.get_course(course_id))
return render_template(
'setup_myprofile.html',
user=user,
courses=courses
)
示例2: setup_usersummary
# 需要导入模块: from oasis.lib import Users2 [as 别名]
# 或者: from oasis.lib.Users2 import get_courses [as 别名]
def setup_usersummary(view_id):
""" Show an account summary for the given user account. """
user_id = session['user_id']
if not check_perm(user_id, -1, "useradmin"):
flash("You do not have User Administration access.")
return redirect(url_for('setup_top'))
is_sysadmin = check_perm(user_id, -1, 'sysadmin')
user = Users2.get_user(view_id)
examids = Exams.get_exams_done(view_id)
exams = []
for examid in examids:
exam = Exams.get_exam_struct(examid)
started = General.human_date(exam['start'])
exam['started'] = started
exam['viewable'] = satisfy_perms(user_id, exam['cid'], ("viewmarks", ))
exams.append(exam)
exams.sort(key=lambda x: x['start_epoch'], reverse=True)
course_ids = Users2.get_courses(view_id)
courses = []
for course_id in course_ids:
courses.append(Courses.get_course(course_id))
user_is_admin = check_perm(view_id, 0, 'sysadmin')
return render_template(
'setup_usersummary.html',
user=user,
exams=exams,
courses=courses,
is_sysadmin=is_sysadmin,
user_is_admin=user_is_admin
)