本文整理汇总了Python中app.helpers.data.DataManager.add_speaker_to_event方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.add_speaker_to_event方法的具体用法?Python DataManager.add_speaker_to_event怎么用?Python DataManager.add_speaker_to_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.helpers.data.DataManager
的用法示例。
在下文中一共展示了DataManager.add_speaker_to_event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_event_cfs_speaker
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_speaker_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,
from_path="cfs")
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_speaker_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')))