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


Python Event.get_next_event_by_date方法代码示例

本文整理汇总了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')
开发者ID:neilbmclaughlin,项目名称:agileyorkshire-events,代码行数:18,代码来源:registration_handlers.py

示例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')
开发者ID:neilbmclaughlin,项目名称:agileyorkshire-events,代码行数:22,代码来源:registration_handlers.py

示例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')
开发者ID:neilbmclaughlin,项目名称:agileyorkshire-events,代码行数:25,代码来源:registration_handlers.py


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