本文整理汇总了Python中evap.evaluation.models.Semester.get_all_with_published_unarchived_results方法的典型用法代码示例。如果您正苦于以下问题:Python Semester.get_all_with_published_unarchived_results方法的具体用法?Python Semester.get_all_with_published_unarchived_results怎么用?Python Semester.get_all_with_published_unarchived_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类evap.evaluation.models.Semester
的用法示例。
在下文中一共展示了Semester.get_all_with_published_unarchived_results方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from evap.evaluation.models import Semester [as 别名]
# 或者: from evap.evaluation.models.Semester import get_all_with_published_unarchived_results [as 别名]
def index(request):
semesters = Semester.get_all_with_published_unarchived_results()
evaluations = Evaluation.objects.filter(course__semester__in=semesters, state='published')
evaluations = [evaluation for evaluation in evaluations if evaluation.can_be_seen_by(request.user)]
if request.user.is_reviewer:
additional_evaluations = get_evaluations_with_prefetched_data(
Evaluation.objects.filter(
course__semester__in=semesters,
state__in=['in_evaluation', 'evaluated', 'reviewed']
)
)
additional_evaluations = get_evaluations_with_course_result_attributes(additional_evaluations)
evaluations += additional_evaluations
evaluations.sort(key=lambda evaluation: (evaluation.course.semester.pk, evaluation.full_name)) # evaluations must be sorted for regrouping them in the template
evaluation_pks = [evaluation.pk for evaluation in evaluations]
degrees = Degree.objects.filter(courses__evaluations__pk__in=evaluation_pks).distinct()
course_types = CourseType.objects.filter(courses__evaluations__pk__in=evaluation_pks).distinct()
template_data = dict(
evaluations=evaluations,
degrees=degrees,
course_types=course_types,
semesters=semesters,
)
return render(request, "results_index.html", template_data)
示例2: include_navbar
# 需要导入模块: from evap.evaluation.models import Semester [as 别名]
# 或者: from evap.evaluation.models.Semester import get_all_with_published_unarchived_results [as 别名]
def include_navbar(user, language):
return {
'user': user,
'language': language,
'published_result_semesters': Semester.get_all_with_published_unarchived_results(),
'result_semesters': Semester.get_all_with_unarchived_results(),
'grade_document_semesters': Semester.objects.filter(grade_documents_are_deleted=False),
}
示例3: index
# 需要导入模块: from evap.evaluation.models import Semester [as 别名]
# 或者: from evap.evaluation.models.Semester import get_all_with_published_unarchived_results [as 别名]
def index(request):
semesters = Semester.get_all_with_published_unarchived_results()
courses = Course.objects.filter(semester__in=semesters, state='published')
courses = [course for course in courses if course.can_user_see_course(request.user)]
if request.user.is_reviewer:
additional_courses = Course.objects.filter(semester__in=semesters, state__in=['in_evaluation', 'evaluated', 'reviewed'])
courses += get_courses_with_prefetched_data(additional_courses)
course_pks = [course.pk for course in courses]
degrees = Degree.objects.filter(courses__pk__in=course_pks).distinct()
course_types = CourseType.objects.filter(courses__pk__in=course_pks).distinct()
template_data = dict(
courses=courses,
degrees=degrees,
course_types=sorted(course_types, key=lambda course_type: course_type.name),
semesters=semesters,
)
return render(request, "results_index.html", template_data)