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


Python PosGraduationFactory.calendar_dao方法代码示例

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


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

示例1: delete_events

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import calendar_dao [as 别名]
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,代码行数:33,代码来源:crud_events.py

示例2: edit_events

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import calendar_dao [as 别名]
def edit_events():
    """Render a view for editing 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)
    index = str(form.index.data)

    if form.validate_on_submit() and form.create.data:
        initial_date = datetime.datetime.combine(form.initial_date.data, datetime.datetime.min.time())
        if form.final_date.data != "":
            final_date = datetime.datetime.strptime(form.final_date.data, '%d/%m/%Y')
            final_date = datetime.datetime.combine(final_date, datetime.datetime.min.time())
        else:
            final_date = form.final_date.data
        new_event = {
            'title': form.title.data,
            'initialDate': initial_date,
            'finalDate': final_date,
            'hour': form.hour.data,
            'link': form.link.data
        }

        dao.find_one_and_update(None, {
            '$set': {'events.' + index : new_event}
        })

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

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

示例3: view_calendar

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import calendar_dao [as 别名]
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,代码行数:16,代码来源:public.py

示例4: add_events

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import calendar_dao [as 别名]
def add_events():
    """Render a view for adding events."""

    form = CalendarForm()

    pfactory = PosGraduationFactory(current_user.pg_initials)
    dao = pfactory.calendar_dao()
    
    if form.validate_on_submit():
        initial_date = datetime.datetime.combine(form.initial_date.data, datetime.datetime.min.time())
        if form.final_date.data != "":
            final_date = datetime.datetime.strptime(form.final_date.data, '%d/%m/%Y')
            final_date = datetime.datetime.combine(final_date, datetime.datetime.min.time())
        else:
            final_date = form.final_date.data
        new_event = {
            'title': form.title.data,
            'initialDate': initial_date,
            'finalDate': final_date,
            'hour': form.hour.data,
            'link': form.link.data
        }

        dao.find_one_and_update(None, {
            '$push': {'events': new_event}
        })

        return redirect(
            url_for(
                'crud_events.add_events',
                success_msg='Evento adicionado adicionado com sucesso.'
            )
        )

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

示例5: home

# 需要导入模块: from models.factory import PosGraduationFactory [as 别名]
# 或者: from models.factory.PosGraduationFactory import calendar_dao [as 别名]
def home(initials):
    """
    Render a post-graduation program page.

    Try to find which program has been requested.

    If it's here: signed in Minerva, show its main page,
    otherwise the user is redirected to that programs external web site.

    If couldn't find which program has been requested, show a 404 page error.
    """

    pfactory = PosGraduationFactory(initials)
    post_graduation = pfactory.post_graduation

    # renders an own page or redirect to another (external/404)?
    if post_graduation is None:
        return page_not_found()

    if not post_graduation['isSignedIn']:
        return redirect(post_graduation['oldURL'])

    # query google maps api
    google_maps_api_dict = keyring.get(keyring.GOOGLE_MAPS)

    google_maps_api_key = 'none'
    if google_maps_api_dict is not None:
        google_maps_api_key = google_maps_api_dict['key']

    # search for home data
    final_reports = pfactory.final_reports_dao().find_one()
    calendar = pfactory.calendar_dao().find_one()['events']
    selections = []
    events = []
    for event in range(len(calendar)):
        if "deleted" not in calendar[event]:
            if "Seleção" in calendar[event]['title']:
                selections.append(calendar[event])
            else:
                events.append(calendar[event])
    final_reports = final_reports['scheduledReports']
    news = pfactory.news_dao().find_one()['news']
    classes = pfactory.classes_database_dao().find_one()['firstClasses']
    integrations_infos = pfactory.integrations_infos_dao().find_one()
    if integrations_infos is None:
        integrations_infos = {
            'name': "",
            'initials': "",
            'logoFile': "",
        }
        institutions_with_covenant = integrations_infos
    else:
        institutions_with_covenant = integrations_infos['institutionsWithCovenant']
    attendance = pfactory.attendances_dao().find_one()
    if attendance is None:
        attendance = {
            'location' : {
                'building' : '',
                'floor' : '',
                'room' : '',
                'opening' : ''
                },
            'email' : '',
            'phones' : {
                'type' : '',
                'number' : ''
                }
        }

    # ready... fire!
    return render_template(
        'public/home.html',
        std=get_std_for_template(post_graduation),
        google_maps_api_key=google_maps_api_key,
        final_reports=final_reports,
        events=events,
        selections=selections,
        classes=classes,
        news=news,
        institutions_with_covenant=institutions_with_covenant,
        attendance=attendance,
    )
开发者ID:Mazuh,项目名称:OAuth2Client-PHP-APIsistemas-PPGP,代码行数:84,代码来源:public.py


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