本文整理汇总了Python中student.Student.query方法的典型用法代码示例。如果您正苦于以下问题:Python Student.query方法的具体用法?Python Student.query怎么用?Python Student.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student.Student
的用法示例。
在下文中一共展示了Student.query方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def get(self):
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
settings_params = {"name": user.nickname(), "graduationProgress": 70}
render_template(self, "settings.html", settings_params)
示例2: get
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def get(self):
query = Student.query().filter(Student.name == "Adina Wallis")
student_list = query.fetch()
for s in student_list:
self.response.write('<p>%s</p>' % s.name)
# s.birthday = '01/01/2000'
# s.put()
s.key.delete()
示例3: post
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def post(self) :
user = users.get_current_user()
falseBoolList = [False] * 40
q = Student.query(Student.email == user.email())
p = q.get()
p.major = self.request.get('Major')
p.put()
render_table(self, q)
return self.redirect("/")
示例4: get
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def get(self) :
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
cur_user = p
gpa_params = {
"name" : user.nickname(),
"studgpa": cur_user.gpa,
'graduationProgress': cur_user.gradProgress,
'credTaken': cur_user.creditsTaken,
}
render_template(self, 'gpa.html', gpa_params)
示例5: post
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def post(self):
user = users.get_current_user()
falseBoolList = [False] * 40
result = db.GqlQuery("SELECT * FROM Student WHERE email = :email", email=user.email())
if result:
for r in result:
r.major = self.request.get("Major")
r.classTaken = falseBoolList
r.gpa = float(self.request.get("GPA"))
r.creditsTaken = int(self.request.get("creditsTaken"))
db.put(r)
q = Student.query(Student.email == user.email())
p = q.get()
render_table(self, q)
示例6: get
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def get(self) :
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
if p.avatar:
self.response.headers['Content-Type'] = 'image/png'
self.response.out.write(p.avatar)
else:
self.response.out.write('No image')
profile_params = {
"name" : user.nickname(),
'graduationProgress': cur_user.gradProgress,
}
render_template(self, 'profilepic.html', profile_params)
示例7: get
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def get(self) :
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
usermajor = p.major
events = p.events
i = 0;
events_string = "events: ["
for e in events:
if i == 0:
events_string = events_string +"{"
i=i+1
else:
events_string = events_string +",{"
events_string = events_string +"id: " +str(e.eventID)+","
events_string = events_string +"title: '"+e.eventTitle+"',"
if e.eventAllDay:
events_string = events_string +"start: '"+ e.eventStart[:10]+"'"
else:
events_string = events_string +"start: '"+ e.eventStart+"',"
events_string = events_string +"end: '"+ e.eventEnd+"'"
events_string = events_string + "}"
events_string = events_string + "]"
now = datetime.datetime.now()
date = now.strftime("%Y-%m-%d")
eventList = []
idList = []
for e in events:
if e.eventID not in idList:
eventList.append(e.eventTitle +" (id: " + str(e.eventID)+")")
idList.append(e.eventID)
settings_params = {
"name" : user.nickname(),
'graduationProgress': 70,
'events': events_string,
'date': date,
'eventList': eventList
}
render_template(self, 'agenda-views.html', settings_params)
示例8: post
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def post(self):
req = self.request.arguments().pop()
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
events = p.events
logging.info(int(req))
for i in xrange(len(p.events) -1, -1, -1):
if p.events[i].eventID==int(req):
del p.events[i]
# event name
p.put()
示例9: post
# 需要导入模块: from student import Student [as 别名]
# 或者: from student.Student import query [as 别名]
def post(self):
req = self.request.arguments().pop()
allreq = req.split(",")
user = users.get_current_user()
q = Student.query(Student.email == user.email())
p = q.get()
usermajor = p.major
events = p.events
i = 0;
if p.curid is None:
p.curid = 0
curid = 0
else:
curid = p.curid+1
p.curid = p.curid+1
# event name
if(len(allreq[0]) > 0 & len(allreq[0]) < 30):
# repeat
if(allreq[2] == "true"):
if(allreq[3] is not None):
# allday
while i < int(allreq[3]):
if(allreq[1] is "true"):
new_event = Events(eventTitle=allreq[0], eventAllDay=True, eventID=curid, eventStart=allreq[4]+"-"+allreq[5]+"-"+str((int(allreq[6])+i*7))+"T"+allreq[7]+":00:00", eventEnd=allreq[8]+"-"+allreq[9]+"-"+allreq[10]+"T"+allreq[11]+":00:00")
else:
new_event = Events(eventTitle=allreq[0], eventAllDay=False, eventID=curid, eventStart=allreq[4]+"-"+allreq[5]+"-"+str((int(allreq[6])+i*7))+"T"+allreq[7]+":00:00", eventEnd=allreq[8]+"-"+allreq[9]+"-"+allreq[10]+"T"+allreq[11]+":00:00")
p.events.append(new_event)
i=i+1
p.put()
i = 0;
events_string = "events: ["
events = p.events
for e in events:
if i == 0:
events_string = events_string +"{"
i=i+1
else:
events_string = events_string +",{"
events_string = events_string +"id: " +str(e.eventID)+","
events_string = events_string +"title: '"+e.eventTitle+"',"
if e.eventAllDay:
events_string = events_string +"start: '"+ e.eventStart[:10]+"'"
else:
events_string = events_string +"start: '"+ e.eventStart+"',"
events_string = events_string +"end: '"+ e.eventEnd+"'"
events_string = events_string + "}"
events_string = events_string + "]"
now = datetime.datetime.now()
date = now.strftime("%Y-%m-%d")
eventList = []
idList = []
for e in events:
if e.eventID not in idList:
eventList.append(e.eventTitle +" (id: " + str(e.eventID)+")")
idList.append(e.eventID)
settings_params = {
"name" : user.nickname(),
'graduationProgress': 70,
'events': events_string,
'date': date,
'eventList': eventList
}
render_template(self, 'agenda-views.html', settings_params)