本文整理汇总了Python中oasis.lib.Courses2.get_topics_list方法的典型用法代码示例。如果您正苦于以下问题:Python Courses2.get_topics_list方法的具体用法?Python Courses2.get_topics_list怎么用?Python Courses2.get_topics_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.Courses2
的用法示例。
在下文中一共展示了Courses2.get_topics_list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: practice_choose_topic
# 需要导入模块: from oasis.lib import Courses2 [as 别名]
# 或者: from oasis.lib.Courses2 import get_topics_list [as 别名]
def practice_choose_topic(course_id):
""" Present a list of topics for them to choose from the given course """
user_id = session['user_id']
try:
course = Courses2.get_course(course_id)
except KeyError:
course = None
abort(404)
try:
topics = Courses2.get_topics_list(course_id)
except KeyError:
topics = []
abort(404)
members = None
for topic in topics:
if topic['visibility'] == 2: # course only
if not members:
members = Courses.get_users(course_id)
if not user_id in members:
topics.remove(topic)
return render_template(
"practicecourse.html",
courses=Setup.get_sorted_courselist(),
canpreview=check_perm(user_id, course_id, "questionpreview"),
topics=topics,
course=course
)
示例2: cadmin_top
# 需要导入模块: from oasis.lib import Courses2 [as 别名]
# 或者: from oasis.lib.Courses2 import get_topics_list [as 别名]
def cadmin_top(course_id):
""" Present top level course admin page """
course = Courses2.get_course(course_id)
if not course:
abort(404)
user_id = session['user_id']
is_sysadmin = check_perm(user_id, -1, 'sysadmin')
topics = Courses2.get_topics_list(course_id)
exams = [Exams.get_exam_struct(exam_id, course_id)
for exam_id in Courses.get_exams(course_id, prev_years=False)]
exams.sort(key=lambda y: y['start_epoch'], reverse=True)
groups = Courses.get_groups(course_id)
choosegroups = [group
for group in Groups.all_groups()
if group.id not in groups]
return render_template(
"courseadmin_top.html",
course=course,
topics=topics,
exams=exams,
choosegroups=choosegroups,
groups=groups,
is_sysadmin=is_sysadmin
)
示例3: cadmin_edittopics
# 需要导入模块: from oasis.lib import Courses2 [as 别名]
# 或者: from oasis.lib.Courses2 import get_topics_list [as 别名]
def cadmin_edittopics(course_id):
""" Present a page to view and edit all topics, including hidden. """
course = None
try:
course = Courses2.get_course(course_id)
except KeyError:
abort(404)
if not course:
abort(404)
topics = Courses2.get_topics_list(course_id)
return render_template("courseadmin_edittopics.html", course=course, topics=topics)
示例4: practice_choose_question
# 需要导入模块: from oasis.lib import Courses2 [as 别名]
# 或者: from oasis.lib.Courses2 import get_topics_list [as 别名]
def practice_choose_question(topic_id):
""" Present a list of questions for them to choose from the given topic """
user_id = session['user_id']
try:
course_id = Topics.get_course_id(topic_id)
except KeyError:
course_id = None
abort(404)
topics = []
try:
topics = Courses2.get_topics_list(course_id)
except KeyError:
abort(404)
try:
course = Courses2.get_course(course_id)
except KeyError:
course = None
abort(404)
topictitle = Topics.get_name(topic_id)
questions = Practice.get_sorted_questions(course_id, topic_id, user_id)
thistopic = Topics.get_topic(topic_id)
members = []
if thistopic['visibility'] == 2: # course only
if not members:
members = Courses.get_users(course_id)
if not user_id in members:
abort(404)
for topic in topics:
if topic['visibility'] == 2: # course only
if not members:
members = Courses.get_users(course_id)
if not user_id in members:
topics.remove(topic)
return render_template(
"practicetopic.html",
canpreview=check_perm(user_id, course_id, "questionpreview"),
topics=topics,
topic_id=topic_id,
course=course,
topictitle=topictitle,
questions=questions
)
示例5: practice_choose_question_stats
# 需要导入模块: from oasis.lib import Courses2 [as 别名]
# 或者: from oasis.lib.Courses2 import get_topics_list [as 别名]
def practice_choose_question_stats(topic_id):
""" Present a list of questions for them to choose from the given topic,
and show some statistics on how they're doing.
"""
user_id = session['user_id']
course_id = Topics.get_course_id(topic_id)
if not course_id:
abort(404)
topics = Courses2.get_topics_list(course_id)
course = Courses2.get_course(course_id)
topictitle = Topics.get_name(topic_id)
questions = Practice.get_sorted_qlist_wstats(course_id, topic_id, user_id)
return render_template(
"practicetopicstats.html",
canpreview=check_perm(user_id, course_id, "questionpreview"),
topics=topics,
topic_id=topic_id,
course=course,
topictitle=topictitle,
questions=questions
)