本文整理汇总了Python中models.UserInfo.query方法的典型用法代码示例。如果您正苦于以下问题:Python UserInfo.query方法的具体用法?Python UserInfo.query怎么用?Python UserInfo.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.UserInfo
的用法示例。
在下文中一共展示了UserInfo.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: current_user_info
# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import query [as 别名]
def current_user_info(self):
if self.user_info is None:
"""Get the current user by lookup if we can"""
if self.username:
self.user_info = UserInfo.get_by_username(self.username)
"""Gets the current user. This involves a query. Its more efficient to perform
lookups with the username and verify that the user_info is current."""
if self.google_user is not None:
users_query = UserInfo.query( UserInfo.google_user==self.google_user)
self.user_info = users_query.get()
if self.oauth_user_id is not None:
users_query = UserInfo.query( UserInfo.oauth_user_id==self.oauth_user_id)
self.user_info = users_query.get()
if self.user_info and self.username is None:
self.username = self.user_info.username
if self.user_info is not None and self.is_user_info_current(self.user_info):
return self.user_info
else:
return None
示例2: flush
# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import query [as 别名]
def flush():
ndb.delete_multi(School.query().fetch(keys_only=True))
ndb.delete_multi(QuestionInstance.query().fetch(keys_only=True))
ndb.delete_multi(State_Questions.query().fetch(keys_only=True))
ndb.delete_multi(Topic_States.query().fetch(keys_only=True))
ndb.delete_multi(Question.query().fetch(keys_only=True))
ndb.delete_multi(State.query().fetch(keys_only=True))
ndb.delete_multi(Address.query().fetch(keys_only=True))
ndb.delete_multi(Teacher.query().fetch(keys_only=True))
ndb.delete_multi(Class.query().fetch(keys_only=True))
ndb.delete_multi(Assessment_Record.query().fetch(keys_only=True))
ndb.delete_multi(Student.query().fetch(keys_only=True))
ndb.delete_multi(UserInfo.query().fetch(keys_only=True))
ndb.delete_multi(Student_Assessments.query().fetch(keys_only=True))
ndb.delete_multi(Assessment.query().fetch(keys_only=True))
ndb.delete_multi(Subject.query().fetch(keys_only=True))
ndb.delete_multi(Topic_Questions.query().fetch(keys_only=True))
ndb.delete_multi(State_Questions.query().fetch(keys_only=True))
ndb.delete_multi(Topic_States.query().fetch(keys_only=True))
ndb.delete_multi(Subject_Topics.query().fetch(keys_only=True))
ndb.delete_multi(Student_Assessments.query().fetch(keys_only=True))
ndb.delete_multi(Topic.query().fetch(keys_only=True))
ndb.delete_multi(User.query().fetch(keys_only=True))
ndb.delete_multi(Assessment_Record.query().fetch(keys_only=True))
ndb.delete_multi(State_Types.query().fetch(keys_only=True))
示例3: post
# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import query [as 别名]
def post(self):
user = users.get_current_user()
upload_files = self.get_uploads('file')
blob_info = upload_files[0]
ui = UserInfo.query(UserInfo.user == user).get()
ui.delicious = blob_info.key()
ui.put()
self.redirect('/')
deferred.defer(delicious, ui.delicious, user, _queue="delicious")
示例4: get
# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import query [as 别名]
def get(self):
ui = UserInfo.query(UserInfo.user == users.get_current_user()).get()
if ui.twitt == False:
ui.twitt = True
html = '<i class="icon-thumbs-up"></i> <strong>Enabled </strong>'
else:
ui.twitt = False
html = '<i class="icon-thumbs-down"></i> <strong>Disabled</strong>'
ui.put()
self.response.write(html)