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


Python Event.start_time方法代码示例

本文整理汇总了Python中models.Event.start_time方法的典型用法代码示例。如果您正苦于以下问题:Python Event.start_time方法的具体用法?Python Event.start_time怎么用?Python Event.start_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Event的用法示例。


在下文中一共展示了Event.start_time方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import start_time [as 别名]
    def save(self, request):
        event = Event()
        start_date = self.cleaned_data['start_date']
        start_time = self.cleaned_data['start_time']
        end_time = self.cleaned_data['end_time']
        event.start_time = datetime.combine(start_date, start_time)
        event.end_time = datetime.combine(start_date, end_time)
        event.event_name = self.cleaned_data['event_name']
        event.event_location = self.cleaned_data['event_location']
        event.event_organizer = self.cleaned_data['event_organizer']
        event.event_description = self.cleaned_data['event_description']
        event.event_website = self.cleaned_data['event_website']
        event.save()

        acl = ACLUserEvent()
        acl.user = request.user
        acl.event = event
        acl.save()

        discussiondefs = (
                            ('PR', _(u'Discussion of the upcoming %s'), _(u'Discuss the upcoming event %s before it actually happens.')), 
                            ('LI', _(u'Live discussion of %s'), _(u'Discuss the ongoing event %s live.')),
                            ('PO', _(u'Post-hoc discussion of %s'), _(u'Discuss %s after the facts.'))
                         )

        for s in discussiondefs:
            thread = Thread()
            thread.time = datetime.now()
            thread.user = request.user
            thread.event = event
            thread.thread_type = s[0];
            thread.title = s[1] % (event.event_name)
            thread.description = s[2] % (event.event_name)
            thread.save()
开发者ID:jeroen51,项目名称:Game-calendar,代码行数:36,代码来源:calendarForms.py

示例2: save_imported_event

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import start_time [as 别名]
    def save_imported_event(project_key, start_time, end_time, event_title, event_description, billed, event_url=None):

        new_ev = Event(parent=project_key)
        new_ev.title = event_title

        new_ev.start_time = start_time
        new_ev.end_time = end_time
        total_seconds = (end_time - start_time).total_seconds()
        new_ev.elapsed_time = int(total_seconds // 60)

        new_ev.description = event_description
        new_ev.billed = billed
        if event_url:
            new_ev.url = event_url
        new_ev.put()

        return
开发者ID:giovamo,项目名称:Sar,代码行数:19,代码来源:profile.py

示例3: convert_to_entity

# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import start_time [as 别名]
def convert_to_entity(vevent):
#     print vevent
    event_key = get_key(find_pattern(uid_pattern, vevent))
    event = Event(key=event_key)
    event.title = find_pattern(summary_pattern, vevent)
    event.content = find_pattern(content_pattern, vevent).replace('\r\n ', '')
    date = find_pattern(time_added_pattern, vevent) # 20150527T131225Z
    event.location = find_pattern(location_pattern, vevent)
    event.time_added = datetime.strptime(date, '%Y%m%dT%H%M%SZ')
    time = find_pattern(start_time_pattern, vevent) # 20150528T190000Z
    event.start_time = datetime.strptime(time, '%Y%m%dT%H%M%SZ')
    time = find_pattern(end_time_pattern, vevent) # 20150528T190000Z
    event.end_time = datetime.strptime(time, '%Y%m%dT%H%M%SZ')
    repeat = find_pattern(repeat_pattern, vevent)
    until = find_pattern(until_pattern, vevent, 2)
    seperator = ""
    if until is not None:
        seperator = ":"
    event.repeat = to_string(repeat) + seperator + to_string(until)
    return event
开发者ID:aapteedea,项目名称:shiloh-ranch,代码行数:22,代码来源:events.py


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