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


Python PosGraduationFactory.grades_of_subjects_dao方法代码示例

本文整理汇总了Python中models.factory.PosGraduationFactory.grades_of_subjects_dao方法的典型用法代码示例。如果您正苦于以下问题:Python PosGraduationFactory.grades_of_subjects_dao方法的具体用法?Python PosGraduationFactory.grades_of_subjects_dao怎么用?Python PosGraduationFactory.grades_of_subjects_dao使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.factory.PosGraduationFactory的用法示例。


在下文中一共展示了PosGraduationFactory.grades_of_subjects_dao方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_subjects

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import grades_of_subjects_dao [as 别名]
def delete_subjects():
    """
    Render a delete subject form.
    """

    course_type = request.args.get('course_type')
    form = SubjectsForm(course_type=course_type)

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.grades_of_subjects_dao()
    json = pfactory.grades_of_subjects_dao().find({'courseType' : course_type})
    json = list(json)
    json = dumps(json)
    if form.validate_on_submit():
        index = str(form.index.data)
        condition = {'title': form.requirement.data, 'courseType' : form.course_type.data}
        dao.find_one_and_update(condition, {
            '$set': {'subjects.' + index + '.deleted' : ""}
        })

        return redirect(
            url_for(
                'crud_subjects.delete_subjects',
                success_msg='Disciplina deletada com sucesso',
                course_type=form.course_type.data
            )
        )
    return render_template(
        'admin/delete_subjects.html',
        form=form,
        subjects=json,
        success_msg=request.args.get('success_msg'),
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:35,代码来源:crud_subjects.py

示例2: edit_subjects

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import grades_of_subjects_dao [as 别名]
def edit_subjects():
    """
    Render an edit subject form.
    """
    course_type = request.args.get('course_type')
    if (course_type is None):
        course_type = 'Mestrado'

    form = SubjectsForm(course_type=course_type)

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.grades_of_subjects_dao()
    json = pfactory.grades_of_subjects_dao().find({'courseType': course_type })
    json = list(json)
    json = dumps(json)
    if form.validate_on_submit():
        index = str(form.index.data)
        new_subject = {
            'name': form.name.data,
            'description': form.description.data,
            'workloadInHours': form.workload_in_hours.data,
            'credits': form.credits.data
        }

        condition = {'title': form.requirement.data, 'courseType' : form.course_type.data}

        dao.find_one_and_update(condition, {
            '$set': {'subjects.' + index : new_subject}
        })
        return redirect(
            url_for(
                'crud_subjects.edit_subjects',
                course_type=form.course_type.data
            )
        )
    return render_template(
        'admin/edit_subjects.html',
        form=form,
        subjects=json,
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:42,代码来源:crud_subjects.py

示例3: view_subjects

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import grades_of_subjects_dao [as 别名]
def view_subjects(initials):
    """Render a view for subjects."""

    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation

    grades_of_subjects = pfactory.grades_of_subjects_dao().find({ '$or': [ { 'title': 'Eletivas' }, { 'title':'Obrigatórias' } ] })

    # renders an own page or redirect to another (external/404)?
    return render_template(
        'public/subjects.html',
        std=get_std_for_template(post_graduation),
        grades_of_subjects=grades_of_subjects
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:16,代码来源:public.py

示例4: subjects

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import grades_of_subjects_dao [as 别名]
def subjects():
    """
    Render a subject form.
    """

    course_type = request.args.get('course_type')
    form = SubjectsForm(course_type=course_type)
    print(course_type, file=sys.stderr)

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.grades_of_subjects_dao()
    if form.validate_on_submit():
        new_subject = {
            'name': form.name.data,
            'description': form.description.data,
            'workloadInHours': form.workload_in_hours.data,
            'credits': form.credits.data
        }

        condition = {'title': form.requirement.data, 'courseType' : form.course_type.data }

        dao.find_one_and_update(condition, {
            '$push': {'subjects': new_subject}
        })

        return redirect(
            url_for(
                'crud_subjects.subjects',
                success_msg='Disciplina adicionada com sucesso.',
                course_type=form.course_type.data,
            )
        )

    return render_template(
        'admin/subjects.html',
        form=form,
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:39,代码来源:crud_subjects.py


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