本文整理汇总了Python中schedule.Schedule.query方法的典型用法代码示例。如果您正苦于以下问题:Python Schedule.query方法的具体用法?Python Schedule.query怎么用?Python Schedule.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.Schedule
的用法示例。
在下文中一共展示了Schedule.query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import query [as 别名]
def get(self):
user = users.get_current_user()
if user != None:
user_name = user.nickname()
access_link = users.create_logout_url('/')
# Get query from database
monday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'lunes')
tuesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'martes')
wednesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'miercoles')
thursday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'jueves')
friday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'viernes')
saturday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'sabado')
sunday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'domingo')
template_values = {
'user_name' : user_name,
'access_link' : access_link,
'monday' : monday,
'tuesday' : tuesday,
'wednesday' : wednesday,
'thursday' : thursday,
'friday' : friday,
'saturday' : saturday,
'sunday' : sunday
}
template = JINJA_ENVIRONMENT.get_template('showSchedule.html')
self.response.write(template.render(template_values));
else:
self.redirect('/')
示例2: post
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import query [as 别名]
def post(self):
user = users.get_current_user()
if user != None:
user_name = user.nickname()
access_link = users.create_logout_url('/')
# Get values from inputs and save into database
day = self.request.get('day')
hourStart = int(self.request.get('hourStart'))
minStart = int(self.request.get('minStart'))
hourEnd = int(self.request.get('hourEnd'))
minEnd = int(self.request.get('minEnd'))
task = self.request.get('task')
# Store data into database
schedule = Schedule()
schedule.user = user.user_id()
schedule.day = day
schedule.hourStart = hourStart
schedule.minStart = minStart
schedule.hourEnd = hourEnd
schedule.minEnd = minEnd
schedule.task = task
schedule.put()
time.sleep(1)
# Get query from database
monday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'lunes')
tuesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'martes')
wednesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'miercoles')
thursday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'jueves')
friday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'viernes')
saturday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'sabado')
sunday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'domingo')
template_values = {
'user_name' : user_name,
'access_link' : access_link,
'monday' : monday,
'tuesday' : tuesday,
'wednesday' : wednesday,
'thursday' : thursday,
'friday' : friday,
'saturday' : saturday,
'sunday' : sunday
}
template = JINJA_ENVIRONMENT.get_template('showSchedule.html')
self.response.write(template.render(template_values));
else:
self.redirect('/')
示例3: get
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import query [as 别名]
def get(self):
user = users.get_current_user()
if user != None:
user_name = user.nickname()
access_link = users.create_logout_url('/')
# Get receipt id
idFieldSchedule = self.request.get('idFieldSchedule', '')
if idFieldSchedule == '':
self.redirect('/error?error=El campo del horario no existe :(')
return
else:
# Get query from database
fieldSchedule = ndb.Key(urlsafe = idFieldSchedule).get()
if fieldSchedule == None:
self.redirect('/error?error=El campo del horario no existe :(')
return
else:
# Delete id
fieldSchedule.key.delete()
time.sleep(1)
# Get query from database
monday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'lunes')
tuesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'martes')
wednesday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'miercoles')
thursday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'jueves')
friday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'viernes')
saturday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'sabado')
sunday = Schedule.query(Schedule.user == user.user_id()).filter(Schedule.day == 'domingo')
template_values = {
'user_name' : user_name,
'access_link' : access_link,
'monday' : monday,
'tuesday' : tuesday,
'wednesday' : wednesday,
'thursday' : thursday,
'friday' : friday,
'saturday' : saturday,
'sunday' : sunday
}
template = JINJA_ENVIRONMENT.get_template('showSchedule.html')
self.response.write(template.render(template_values));
else:
self.redirect('/')