当前位置: 首页>>代码示例>>Python>>正文


Python Semester.get_all_with_published_unarchived_results方法代码示例

本文整理汇总了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)
开发者ID:fsr-itse,项目名称:EvaP,代码行数:29,代码来源:views.py

示例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),
    }
开发者ID:PFischbeck,项目名称:EvaP,代码行数:10,代码来源:navbar_templatetags.py

示例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)
开发者ID:PFischbeck,项目名称:EvaP,代码行数:21,代码来源:views.py


注:本文中的evap.evaluation.models.Semester.get_all_with_published_unarchived_results方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。