本文整理汇总了Python中models.event.Event.event_name方法的典型用法代码示例。如果您正苦于以下问题:Python Event.event_name方法的具体用法?Python Event.event_name怎么用?Python Event.event_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.event.Event
的用法示例。
在下文中一共展示了Event.event_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import event_name [as 别名]
def post(self, arg):
if self.request.POST['i-save-event']:
n = self.request.POST['i-name']
d = self.request.POST['i-startdate']
v = Validator()
errors = [];
#is it an existing event or not?
if arg.isdigit():
nE = Event.get_by_id(int(arg))
nDs = Day.gql("WHERE event = :1", nE).fetch(3)
elif arg == 'nieuw':
nE = Event(tables=40, talk_time=15)
nDs = [Day(talks=12), Day(talks=12), Day(talks=12)]
#validate data
if not v.vString(n):
errors.append('onjuiste titel ouderavondreeks')
else:
nE.event_name = n
if not v.vDate(d):
errors.append('onjuiste startdatum')
else:
d = map(int, (d.split('-')))
sD = datetime.datetime(year=d[0], month=d[1], day=d[2], hour=20, minute=00)
nDs[0].date = sD
#show errors if they exist
if errors:
path = os.path.join(os.path.dirname(__file__), '../templates/administration/event-edit.html')
monthText = ''
if nDs[0].date:
monthText = self.getMonthText(nDs[0].date.month)
tv = {
'errors': errors,
'event': nE,
'day': nDs[0],
'monthText': monthText,
'logoutlink': users.create_logout_url("/")
}
self.response.out.write(template.render(path, tv))
#update event in datastore if no error exists
else:
nE.put()
#add two other dates and store them
delta = datetime.timedelta(days=1)
if nDs[0].date.weekday() < 3:
nDs[1].date = deepcopy(nDs[0].date) + delta
nDs[2].date = deepcopy(nDs[0].date) + delta*2
elif nDs[0].date.weekday() == 3:
nDs[1].date = deepcopy(nDs[0].date) + delta
nDs[2].date = deepcopy(nDs[0].date) + delta*3
elif nDs[0].date.weekday() == 4:
nDs[1].date = deepcopy(nDs[0].date) + delta*3
nDs[2].date = deepcopy(nDs[0].date) + delta*4
for d in nDs:
d.event = nE
d.updateEndTime()
d.put()
self.redirect('/administratie')