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


Python DataManager.edit_session方法代码示例

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


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

示例1: process_session_view

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import edit_session [as 别名]
def process_session_view(session_id):
    if request.method == 'GET':
        session = DataGetter.get_sessions_of_user_by_id(session_id)
        if not session:
            abort(404)
        form_elems = DataGetter.get_custom_form_elements(session.event_id)
        if not form_elems:
            flash("Speaker and Session forms have been incorrectly configured for this event."
                  " Session creation has been disabled", "danger")
            return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))
        speaker_form = json.loads(form_elems.speaker_form)
        session_form = json.loads(form_elems.session_form)
        event = DataGetter.get_event(session.event_id)
        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()
        return render_template(
            'gentelella/users/mysessions/mysession_detail_edit.html', session=session,
            photo_delete_url=url_for('.avatar_delete', event_id=event.id, speaker_id=speaker.id),
            speaker_form=speaker_form, session_form=session_form, event=event, speaker=speaker)

    if request.method == 'POST':
        session = DataGetter.get_sessions_of_user_by_id(session_id)
        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()
        DataManager.edit_session(request, session, speaker)
        flash("The session has been updated successfully", "success")
        return redirect(url_for('.display_session_view', session_id=session_id))
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:27,代码来源:my_sessions.py

示例2: edit_view

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import edit_session [as 别名]
def edit_view(event_id, session_id):
    event = DataGetter.get_event(event_id)
    if not event.has_session_speakers:
        return render_template('gentelella/users/events/info/enable_module.html', active_page='sessions',
                               title='Sessions', event=event)

    session = get_session_or_throw(session_id)
    if request.method == 'POST':
        DataManager.edit_session(request, session)
        return redirect(url_for('.index_view', event_id=event_id))

    form_elems = DataGetter.get_custom_form_elements(event_id)
    if not form_elems:
        flash("Speaker and Session forms have been incorrectly configured for this event."
              " Session creation has been disabled", "danger")
        return redirect(url_for('.index_view', event_id=event_id))
    session_form = json.loads(form_elems.session_form)
    speakers = DataGetter.get_speakers(event_id).all()
    return render_template('gentelella/users/events/sessions/edit.html', session=session,
                           session_form=session_form, event=event, speakers=speakers)
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:22,代码来源:sessions.py

示例3: process_session_view

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import edit_session [as 别名]
 def process_session_view(self, session_id):
     session = DataGetter.get_sessions_of_user_by_id(session_id)
     DataManager.edit_session(request, session)
     flash("The session has been updated successfully", "success")
     return redirect(url_for('.display_session_view', session_id=session_id))
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:7,代码来源:my_sessions.py


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