本文整理汇总了Python中models.event.Event.get_next_event_by_date方法的典型用法代码示例。如果您正苦于以下问题:Python Event.get_next_event_by_date方法的具体用法?Python Event.get_next_event_by_date怎么用?Python Event.get_next_event_by_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.event.Event
的用法示例。
在下文中一共展示了Event.get_next_event_by_date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import get_next_event_by_date [as 别名]
def index(self):
next_event = Event.get_next_event_by_date()
if next_event:
ancestor_key = next_event.key
registrations_query = Registration.query(ancestor=ancestor_key).order(Registration.name)
registrations = registrations_query.fetch(100)
template_values = {
'registrations': registrations,
'event_name': urllib.quote_plus(next_event.title),
}
self.render('registrations.html', template_values)
else:
self.response.write('Event name not specified')
示例2: post
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import get_next_event_by_date [as 别名]
def post(self):
next_event = Event.get_next_event_by_date()
registration = Registration(parent=next_event.key)
registration.email_address = self.request.get('email_address')
registration.name= self.request.get('name')
registration.twitter_handle = self.request.get('twitter_handle')
registration.confirmed = False
key = registration.put()
registration_url = self.url_for('registration', _full=True, registration_id=key.urlsafe())
print registration_url
mail.send_mail(
'[email protected]',
registration.email_address,
'click link to confirm',
registration_url)
self.redirect('/register')
示例3: get
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import get_next_event_by_date [as 别名]
def get(self):
next_event = Event.get_next_event_by_date()
if next_event:
registration_opens = next_event.date - timedelta(days=14)
registration_open = datetime.now() > registration_opens
presentations = Presentation.query(ancestor=self.get_group_key()).filter(Presentation.event_key == next_event.key).fetch(100)
registrations = Registration.query(ancestor=next_event.key).fetch(100)
template_values = {
'registrations_remaining': ( next_event.capacity - Registration.query(ancestor=next_event.key).count(next_event.capacity) ),
'registrations': registrations,
'event': next_event,
'presentations': presentations,
'registration_open': registration_open,
'registration_opens': registration_opens
}
self.render('register.html', template_values)
else:
self.response.write('There is no next event setup')