本文整理汇总了Python中app.helpers.data.DataManager.add_session_to_event方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.add_session_to_event方法的具体用法?Python DataManager.add_session_to_event怎么用?Python DataManager.add_session_to_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.helpers.data.DataManager
的用法示例。
在下文中一共展示了DataManager.add_session_to_event方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_event_cfs
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_session_to_event [as 别名]
def process_event_cfs(identifier, via_hash=False):
if request.method == 'GET':
event = get_published_event_or_abort(identifier)
placeholder_images = DataGetter.get_event_default_images()
if event.sub_topic:
custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
elif event.topic:
custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
else:
custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
if not event.has_session_speakers:
abort(404)
call_for_speakers = DataGetter.get_call_for_papers(event.id).first()
if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
abort(404)
form_elems = DataGetter.get_custom_form_elements(event.id)
speaker_form = json.loads(form_elems.speaker_form)
session_form = json.loads(form_elems.session_form)
now = datetime.now(pytz.timezone(event.timezone
if (event.timezone and event.timezone != '') else 'UTC'))
start_date = pytz.timezone(event.timezone).localize(call_for_speakers.start_date)
end_date = pytz.timezone(event.timezone).localize(call_for_speakers.end_date)
state = "now"
if end_date < now:
state = "past"
elif start_date > now:
state = "future"
speakers = DataGetter.get_speakers(event.id).all()
user_speaker = DataGetter.get_speaker_by_email_event(login.current_user.email, event.id)
accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
return render_template('gentelella/guest/event/cfs_new_session.html',
event=event,
speaker_form=speaker_form,
user_speaker=user_speaker,
accepted_sessions_count=accepted_sessions_count,
session_form=session_form,
call_for_speakers=call_for_speakers,
placeholder_images=placeholder_images,
state=state,
speakers=speakers,
via_hash=via_hash,
custom_placeholder=custom_placeholder,
from_path="cfs")
if request.method == 'POST':
event = DataGetter.get_event_by_identifier(identifier)
if not event.has_session_speakers:
abort(404)
if login.current_user.is_authenticated:
DataManager.add_session_to_event(request, event.id, no_name=True)
flash("Your session proposal has been submitted", "success")
return redirect(url_for('my_sessions.display_my_sessions_view', event_id=event.id))
return redirect(url_for('admin.login_view', next=url_for('my_sessions.display_my_sessions_view')))
示例2: process_event_cfs_speaker
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_session_to_event [as 别名]
def process_event_cfs_speaker(identifier, via_hash=False):
if request.method == 'GET':
event = get_published_event_or_abort(identifier)
placeholder_images = DataGetter.get_event_default_images()
if event.sub_topic:
custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
elif event.topic:
custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
else:
custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
if not event.has_session_speakers:
abort(404)
call_for_speakers = DataGetter.get_call_for_papers(event.id).first()
if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
abort(404)
form_elems = DataGetter.get_custom_form_elements(event.id)
speaker_form = json.loads(form_elems.speaker_form)
session_form = json.loads(form_elems.session_form)
now = datetime.now(pytz.timezone(event.timezone
if (event.timezone and event.timezone != '') else 'UTC'))
start_date = pytz.timezone(event.timezone).localize(call_for_speakers.start_date)
end_date = pytz.timezone(event.timezone).localize(call_for_speakers.end_date)
state = "now"
if end_date < now:
state = "past"
elif start_date > now:
state = "future"
speakers = DataGetter.get_speakers(event.id).all()
accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
return render_template('gentelella/guest/event/cfs_new_speaker.html', event=event,
speaker_form=speaker_form,
accepted_sessions_count=accepted_sessions_count,
session_form=session_form, call_for_speakers=call_for_speakers,
placeholder_images=placeholder_images, state=state, speakers=speakers,
via_hash=via_hash, custom_placeholder=custom_placeholder)
if request.method == 'POST':
email = request.form['email']
event = DataGetter.get_event_by_identifier(identifier)
if not event.has_session_speakers:
abort(404)
DataManager.add_session_to_event(request, event.id)
if login.current_user.is_authenticated:
flash("You have been registered as Speaker", "success")
return redirect(url_for('event_detail.display_event_cfs', identifier=identifier))
else:
flash(Markup(
"You have been registered as Speaker. Please login/register with <strong><u>" + email + "</u></strong> to manage it."),
"success")
return redirect(url_for('admin.login_view', next=url_for('my_sessions.display_my_sessions_view')))
示例3: process_event_cfs
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_session_to_event [as 别名]
def process_event_cfs(self, identifier):
email = request.form['email']
event = DataGetter.get_event_by_identifier(identifier)
if not event.has_session_speakers:
abort(404)
DataManager.add_session_to_event(request, event.id)
if login.current_user.is_authenticated:
flash("Your session proposal has been submitted", "success")
return redirect(url_for('my_sessions.display_my_sessions_view', event_id=event.id))
else:
flash(Markup("Your session proposal has been submitted. Please login/register with <strong><u>" + email + "</u></strong> to manage it."), "success")
return redirect(url_for('admin.login_view', next=url_for('my_sessions.display_my_sessions_view')))
示例4: create_view
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_session_to_event [as 别名]
def create_view(event_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)
if request.method == 'POST':
DataManager.add_session_to_event(request, event_id, use_current_user=False)
flash("The session and speaker have been saved")
get_from = request.args.get("from")
if get_from and get_from == 'speaker':
return redirect(url_for('event_speakers.index_view', event_id=event_id))
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))
speaker_form = json.loads(form_elems.speaker_form)
session_form = json.loads(form_elems.session_form)
speakers = DataGetter.get_speakers(event_id).all()
return render_template('gentelella/users/events/sessions/new.html',
speaker_form=speaker_form, session_form=session_form, event=event, speakers=speakers)