• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python factory.PosGraduationFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: edit_project

def edit_project():
    """Render project editing form."""

    form = ProjectForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.projects_database_dao()
    projects = pfactory.projects_database_dao().find()
    projects = list(projects)
    projects = dumps(projects)
    if form.validate_on_submit() and form.create.data:
        new_project = {
            'title': form.title.data,
            'subtitle': form.subtitle.data,
            'description': form.description.data,
            'situation': form.situation.data,
            'year': form.year.data,
            'email': form.email.data,
            'dt_init': form.dt_init.data,
            'dt_end': form.dt_end.data
        }
        dao.find_one_and_update({'_id' : ObjectId(form.project_id.data)}, {
            '$set' : new_project})
        return redirect(
            url_for(
                'crud_projects.edit_project',
                success_msg='Projeto editado com sucesso.'
            )
        )
    return render_template(
        'admin/edit_projects.html',
        form=form,
        projects=projects,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:35,代码来源:crud_projects.py


示例2: delete_project

def delete_project():
    """Render project deleting form."""

    form = ProjectForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.projects_database_dao()
    projects = pfactory.projects_database_dao().find()
    projects = list(projects)
    projects = dumps(projects)
    if form.validate_on_submit() and form.create.data:
        dao.find_one_and_update({'_id' : ObjectId(form.project_id.data)}, {
            '$set' : {'deleted' : '' }})
        return redirect(
            url_for(
                'crud_projects.delete_project',
                success_msg='Projeto deletado com sucesso.'
            )
        )
    return render_template(
        'admin/delete_project.html',
        form=form,
        projects=projects,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:25,代码来源:crud_projects.py


示例3: get

 def get(nick, authenticated=False):
     """Return an User from database. If failed, None."""
     try:
         condition = {'users.nick': nick}
         pfactory = PosGraduationFactory()
         dao = pfactory.post_graduations_dao()
         program = list(dao.find(condition))
         if program:
             initials = program[0]['initials']
         else:
             return None
         for user in program[0]['users']:
             if nick.lower() == user['nick'].lower():
                 found_user = User()
                 found_user._nick = user['nick']
                 found_user._pg_initials = initials.lower()
                 found_user._full_name = user['fullName']
                 found_user._role = user['role']
                 found_user._email = user['email']
                 found_user._token = user['token']
                 found_user.__is_authenticated = authenticated
                 found_user.__is_active = True
                 found_user.__is_anonymous = False
                 return found_user
         return None
     except (TypeError, AttributeError):
         return None
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:27,代码来源:users.py


示例4: view_member

def view_member():

    form = MemberOfProjectForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    projects = pfactory.projects_database_dao().find()
    projects = list(projects)
    projects = dumps(projects)
    if request.args.get('crud_type') == 'Adicionar':
        return render_template(
            'admin/add_member_in_project.html',
            form=form,
            projects=projects,
            crud_type=request.args.get('crud_type'),
            success_msg=request.args.get('success_msg')
        )
    if request.args.get('crud_type') == 'Deletar':
        return render_template(
            'admin/delete_member_in_project.html',
            form=form,
            projects=projects,
            crud_type=request.args.get('crud_type'),
            success_msg=request.args.get('success_msg')
        )
    else:
        return render_template(
            'admin/edit_member_in_project.html',
            form=form,
            projects=projects,
            crud_type=request.args.get('crud_type'),
            success_msg=request.args.get('success_msg')
        )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:32,代码来源:crud_projects.py


示例5: delete_chapter

def delete_chapter():
    """
    Render a chapter delete form
    """

    form = ChapterForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.publications_dao()
    publications = pfactory.publications_dao().find_one()
    publications = dict(publications)
    publications = dumps(publications)

    if form.validate_on_submit() and form.create.data:
        index = str(form.index.data)
        dao.find_one_and_update(None, {
            '$set': {'chapters.' + index + '.deleted' : ''}
        })

        return redirect(
            url_for(
                'crud_books.delete_chapter',
                success_msg='Capítulo deletado com sucesso.'))

    return render_template(
        'admin/delete_chapters.html',
        publications=publications,
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:30,代码来源:crud_books.py


示例6: delete_book

def delete_book():
    """
    Render a book deleting form
    """

    form = BookForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.publications_dao()
    json = pfactory.publications_dao().find_one()
    json = dict(json)
    json = dumps(json)

    if form.validate_on_submit() and form.create.data:
        index = str(form.index.data)
        dao.find_one_and_update(None, {
            '$set': {'books.' + index + '.deleted' : ''}
        })

        return redirect(
            url_for(
                'crud_books.delete_book',
                success_msg='Livro deletado com sucesso.'))

    return render_template(
        'admin/delete_books.html',
        publications=json,
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:30,代码来源:crud_books.py


示例7: delete_staff

def delete_staff():
    """
    Render a delete staff form.
    """

    form = StaffForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.boards_of_staffs_dao()
    json = pfactory.boards_of_staffs_dao().find_one()
    json = dict(json)
    json = dumps(json)
    index = '.' + str(form.index.data)
    if form.validate_on_submit():
        dao.find_one_and_update(None, {
            '$set': {form.function.data + index + '.deleted' : ''}
            })
        return redirect(
            url_for(
                'crud_staff.delete_staff',
                success_msg='Servidor deletado com sucesso.',
                staff=json
                )
        )

    return render_template(
        'admin/delete_staff.html',
        form=form,
        success_msg=request.args.get('success_msg'),
        staff=json
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:31,代码来源:crud_staff.py


示例8: delete_subjects

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,代码行数:33,代码来源:crud_subjects.py


示例9: delete_events

def delete_events():
    """Render a view for deleting events."""

    form = CalendarForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.calendar_dao()
    json = pfactory.calendar_dao().find_one()
    json = dict(json)
    json = dumps(json)

    if form.validate_on_submit() and form.create.data:
        index = str(form.index.data)
        dao.find_one_and_update(None, {
            '$set': {'events.' + index + '.deleted' : ""}
        })

        return redirect(
            url_for(
                'crud_events.delete_events',
                events=json,
                success_msg='Evento deletado com sucesso.'
            )
        )

    return render_template(
        'admin/delete_events.html',
        events=json,
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:31,代码来源:crud_events.py


示例10: delete_news

def delete_news():

    form = NewsForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.news_dao()
    news = pfactory.news_dao().find_one()
    news = dict(news)
    news = dumps(news)

    if form.validate_on_submit() and form.create.data:
        index = str(form.index.data)
        dao.find_one_and_update(None, {
            '$set': {'news.' + index + '.deleted' : ''}
        })

        return redirect(
            url_for(
                'crud_news.delete_news',
                success_msg='Notícia deletada com sucesso.'))

    return render_template(
        'admin/delete_news.html',
        news=news,
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:27,代码来源:crud_news.py


示例11: delete_scheduled_reports

def delete_scheduled_reports():

    form = ScheduledReportForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.final_reports_dao()
    json = pfactory.final_reports_dao().find_one()
    json = dict(json)

    json = dumps(json)

    if form.validate_on_submit() and form.create.data:
        index = str(form.index.data)
        dao.find_one_and_update(None, {
            '$set': {'scheduledReports.' + index + '.deleted' : ""}
        })
        return redirect(
            url_for(
                'crud_scheduled_reports.delete_scheduled_reports',
                final_reports=json,
                success_msg='Agendamento deletado com sucesso'
            )
        )

    return render_template(
        'admin/delete_scheduled_reports.html',
        final_reports=json,
        form=form,
        post_graduation=current_user.pg_initials,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:31,代码来源:crud_scheduled_reports.py


示例12: scheduled_reports

def scheduled_reports():
    """
    Render a report scheduling form.
    """

    form = ScheduledReportForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.final_reports_dao()

    if form.validate_on_submit():
        new_report = {
            'time': datetime.combine(form.date.data, form.time.data.time()),
            'title': form.title.data,
            'author': form.author.data,
            'location': form.location.data
        }

        dao.find_one_and_update(None, {
            '$push': {'scheduledReports': new_report}
        })

        return redirect(
            url_for(
                'crud_scheduled_reports.scheduled_reports',
                success_msg='Defesa de tese adicionada com sucesso.'
            )
        )

    return render_template(
        'admin/scheduled_reports.html',
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:34,代码来源:crud_scheduled_reports.py


示例13: view_classes

def view_classes(initials):
    """Render a view for classes list."""

    form = FindClass()
    
    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation
    now = datetime.datetime.now()
    if now.month <= 7:
        semester = 1
    else:
        semester = 2
    classes=pfactory.classes_dao(now.year,semester,100).find()
    if form.validate_on_submit():
        return redirect(
            url_for(
                'public.find_classes',
                initials=initials,
                year=form.year.data,
                period=form.period.data
            )
        )

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


示例14: edit_staff

def edit_staff():
    """
    Render a staff form.
    """

    form = StaffForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.boards_of_staffs_dao()
    json = pfactory.boards_of_staffs_dao().find_one()
    json = dict(json)
    json = dumps(json)

    dao = pfactory.boards_of_staffs_dao()

    if form.validate_on_submit():
        index = '.' + str(form.index.data)
        if form.photo.data == '':
            photo = None
        else:
            photo = form.photo.data
        if form.function.data == 'coordination':
            new_staff = {
                'name': form.name.data,
                'rank': form.rank.data,
                'abstract': form.abstract.data,
                'photo': photo
            }

        else:
            new_staff = {
                'name': form.name.data,
                'function': {
                    'rank': form.rank.data,
                    'description': form.abstract.data
                },
                'photo': photo
            }
        dao.find_one_and_update(None, {
            '$set': {form.function.data + index: new_staff}
            })
        return redirect(
            url_for(
                'crud_staff.edit_staff',
                success_msg='Servidor editado com sucesso.',
                staff=json
                )
        )

    return render_template(
        'admin/edit_staff.html',
        form=form,
        success_msg=request.args.get('success_msg'),
        staff=json
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:55,代码来源:crud_staff.py


示例15: find_classes

def find_classes():
    form = FindClass()
    pfactory = PosGraduationFactory(request.args['initials'])
    post_graduation = pfactory.post_graduation
    classes_2 =pfactory.classes_dao(request.args['year'], request.args['period'], 100).find()
    return render_template(
        'public/subjectsinclasses.html',
        std=get_std_for_template(post_graduation),
        form=form,
        classes=classes_2
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:11,代码来源:public.py


示例16: edit_attendance

def edit_attendance():

    form = AttendanceForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.attendances_dao()
    json = pfactory.attendances_dao().find_one()
    json = dict(json)
    json = dumps(json)

    if form.validate_on_submit() and form.create.data:
        new_attendance = {
            'location' : {
                'building' : form.building.data,
                'floor' : form.floor.data,
                'room' : form.room.data,
                'opening' : form.opening.data
            },
            'email': form.email.data,
            'calendar': form.calendar.data,
            'phones' : {
                '0' : {
                    'type' : form.type1.data,
                    'number': form.phone1.data
                },
                '1' : {
                    'type': form.type2.data,
                    'number': form.phone2.data
                },
                '2' : {
                    'type': form.type3.data,
                    'number': form.phone3.data
                }
            }
        }

        dao.find_one_and_update({'_id' : ObjectId(form.attendance_id.data)}, {
            '$set': new_attendance
        })

        return redirect(
            url_for(
                'crud_attendances.edit_attendance',
                success_msg='Contato editado com sucesso.'))

    return render_template(
        'admin/edit_attendance.html',
        attendance=json,
        form=form,
        success_msg=request.args.get('success_msg')
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:51,代码来源:crud_attendances.py


示例17: view_calendar

def view_calendar(initials):
    """Render a view for calendar."""

    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation

    calendar_info = pfactory.calendar_dao().find_one()

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


示例18: view_documents_others

def view_documents_others(initials):
    """Render a view for documents list."""

    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation

    documents = pfactory.official_documents_dao().find({'category':'outros'})

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


示例19: view_subjects

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,代码行数:14,代码来源:public.py


示例20: view_covenants

def view_covenants(initials):
    """Render a view for integrations lists."""

    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation

    integrations_infos = pfactory.integrations_infos_dao().find_one()

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python favorite.Favorite类代码示例发布时间:2022-05-27
下一篇:
Python event_team.EventTeam类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap