本文整理汇总了Python中models.event.Event.description方法的典型用法代码示例。如果您正苦于以下问题:Python Event.description方法的具体用法?Python Event.description怎么用?Python Event.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.event.Event
的用法示例。
在下文中一共展示了Event.description方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testInsertEvent
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import description [as 别名]
def testInsertEvent(self):
event = Event(parent=ndb.Key('Group', 'Agile'))
event.date = datetime.now()
event.description = 'An event'
event.capacity = 20
event.put()
self.assertEqual(1, len(Event.query().fetch(2)))
示例2: create_event
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import description [as 别名]
def create_event(self, capacity=20, event_date=datetime.now() + timedelta(days=5), registration_window=5):
event = Event(parent=ndb.Key('Group', 'AgileYorkshire'))
event.date = event_date
event.description = 'An event'
event.capacity = capacity
event.registration_window = registration_window
event.put()
return event
示例3: post
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import description [as 别名]
def post(self):
event = Event(parent=self.get_group_key())
event.date = datetime.strptime(self.request.get('event_date'), "%d %b %Y")
event.title = self.request.get('event_title')
event.description = self.request.get('event_description')
event.capacity = int(self.request.get('event_capacity'))
event.registration_window = int(self.request.get('event_registration_window'))
event_image = self.request.get('event_image')
event.image = event_image
presentations = self.request.get_all('event_presentations')
event_key = event.put()
for p in presentations:
presentation_key = ndb.Key(urlsafe=p)
presentation = presentation_key.get()
presentation.event_key = event_key
presentation.put()
self.redirect('/events')
示例4: set_event_details
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import description [as 别名]
def set_event_details(e_id, name, date, city, add, descr, host, url, attendees, price, category, source):
event1 = Event()
qry = event1.check_event_exist(e_id) or event1.check_event_exist_by_name(name)
if qry is False:
event1.id = e_id
event1.name = name
event1.date = date
event1.city = city
event1.address = add
event1.description = descr
event1.host = host
event1.event_url = url
event1.source = source
if (attendees != "Unknown"):
event1.attendees = attendees
event1.price = price
if category is not None:
event1.category = category
key = event1.put()
return key
else: # Update existing meetings! It could be changed or canceled!
qry.name = name
qry.date = date
qry.city = city
qry.address = add
qry.description = descr
qry.host = host
qry.event_url = url
qry.source = source
qry.price = price
if category is not None:
qry.category = category
results = Attendings.query(Attendings.event_id == qry.get_by_id(e_id))
if results is not None:
qry.attendees = attendees + results.count()
else:
qry.attendees = attendees
qry.put()
示例5: get
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import description [as 别名]
def get(self):
credentials = AppAssertionCredentials("https://www.googleapis.com/auth/calendar.readonly")
http_auth = credentials.authorize(Http())
cal_service = discovery.build('calendar', 'v3', http=http_auth)
service_settings = ServiceSettings.query().get()
if not service_settings:
service_settings = ServiceSettings()
next_sync_token = service_settings.cal_sync_token
cal_events = []
if next_sync_token:
now = None
else:
now = strict_rfc3339.now_to_rfc3339_utcoffset()
try:
events_result = cal_service.events().list(calendarId="[email protected]", timeMin=now,
syncToken=next_sync_token).execute()
except:
service_settings.cal_sync_token = None
service_settings.put()
raise
cal_events += events_result.get('items', [])
next_page_token = events_result.get('nextPageToken', None)
while next_page_token:
events_result = cal_service.events().list(calendarId="[email protected]", timeMin=now,
syncToken=next_sync_token, pageToken=next_page_token).execute()
cal_events += events_result.get('items', [])
next_page_token = events_result.get('nextPageToken', None)
next_sync_token = events_result.get("nextSyncToken", None)
service_settings.cal_sync_token = next_sync_token
service_settings.put()
for cal_event in cal_events:
cal_id = cal_event.get("id")
event = Event.query().filter(Event.cal_id == cal_id).get()
if event:
q = taskqueue.Queue('default')
for task in event.tasks:
q.delete_tasks(taskqueue.Task(name=task))
event.tasks = []
if cal_event.get("status") == "cancelled":
event.key.delete()
logging.info("Event deleted: %s", event)
continue
else:
event = Event(cal_id=cal_id)
event.put()
summary = cal_event.get("summary")
description = cal_event.get("description")
start = cal_event.get("start")
end = cal_event.get("end")
start = parse_date_time(start.get("date"), start.get("dateTime"))
end = parse_date_time(end.get("date"), end.get("dateTime"))
event.summary = summary
event.description = description
event.start = start
event.end = end
set_event_reminders(event)
event.put()
logging.info("New event created: %s", event)