本文整理汇总了Python中schedule.models.Event.end方法的典型用法代码示例。如果您正苦于以下问题:Python Event.end方法的具体用法?Python Event.end怎么用?Python Event.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.models.Event
的用法示例。
在下文中一共展示了Event.end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from schedule.models import Event [as 别名]
# 或者: from schedule.models.Event import end [as 别名]
def save(self, force_insert=False, force_update=False):
new_meeting = False
if not self.id:
new_meeting = True
unique_slugify(self,
"-".join([self.circle.short_name,
self.name,
self.date_and_time.strftime('%Y-%m-%d')])
)
super(Meeting, self).save(force_insert, force_update)
end = self.date_and_time + timedelta(minutes=self.duration)
title = " ".join([self.circle.short_name, self.get_name_display()])
if new_meeting:
event = Event(
start=self.date_and_time,
end=end,
title=title,
household_location=self.household_location,
alternate_location=self.alternate_location,
description=self.description)
event.save()
rel = EventRelation.objects.create_relation(event, self)
rel.save()
try:
cal = Calendar.objects.get(pk=1)
except Calendar.DoesNotExist:
cal = Calendar(name="Community Calendar")
cal.save()
cal.events.add(event)
else:
event = Event.objects.get_for_object(self)[0]
event.start = self.date_and_time
event.end = end
event.title = title
event.household_location = self.household_location
event.alternate_location = self.alternate_location
event.description = self.description
event.save()