本文整理汇总了Python中models.Event.get_future_events方法的典型用法代码示例。如果您正苦于以下问题:Python Event.get_future_events方法的具体用法?Python Event.get_future_events怎么用?Python Event.get_future_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Event
的用法示例。
在下文中一共展示了Event.get_future_events方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: events
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import get_future_events [as 别名]
def events():
'''Route to Events collection.'''
user = g.user
if user.is_director or user.is_admin:
events = Event.get_future_events()
return render_template('event/events.html', events=events, user=user)
abort(404)
示例2: request_new
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import get_future_events [as 别名]
def request_new():
'''Add a new request.'''
user = g.user
form = NewRequestForm()
form.instrument.choices = [(instr.id, instr.name)
for instr in user.instruments]
choices = [(event.id, event.event_type.name + ' ' +
event.date.strftime('%a %b %d, %I:%M%p'))
for event in Event.get_future_events()]
form.event_id.choices = choices
if form.validate_on_submit():
band_id = form.band_id.data
event_id = form.event_id.data
instrument_id = form.instrument.data
part = form.part.data if form.part.data else ''
info = form.info.data if form.info.data else ''
req_id = add_request(band_id=band_id, event_id=event_id,
instrument_id=instrument_id, part=part, info=info)
if req_id:
return redirect(url_for('req', request_id=req_id))
form.errors['event_id'] = \
['You have already created a request for this event.']
return render_template('request/new.html', form=form, user=user)