本文整理汇总了Python中model.Task.query方法的典型用法代码示例。如果您正苦于以下问题:Python Task.query方法的具体用法?Python Task.query怎么用?Python Task.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Task
的用法示例。
在下文中一共展示了Task.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import query [as 别名]
def post(self):
print 'UploadImageService >> get upload image request ', str(len(self.get_uploads()))
if len(self.get_uploads())!=0:
blobkey = ""
for upload in self.get_uploads():
blobkey = upload.key()
task_id = self.request.get(IDENTIFIER_TASK_ID)
tasks = Task.query(Task.task_id == task_id).fetch()
target_task = tasks[0]
target_task.photo_blobkey = blobkey
target_task.put()
print 'UploadImageService >> image upload success'
示例2: get
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import query [as 别名]
def get(self):
print("get finish task request")
task_id = self.request.get(IDENTIFIER_TASK_ID)
total_cost = self.request.get(IDENTIFIER_TOTAL_COST)
user_email = self.request.get(IDENTIFIER_USER_EMAIL)
total_cost = float(total_cost)
print("get cost " + str(total_cost))
tasks = Task.query(Task.task_id == task_id).fetch()
task = tasks[0]
print("Found the task " + task.task_name)
if task.finished:
response = {}
response['error'] = 'the task has already been finished'
return self.respond(**response)
if user_email != task.charger_email:
response = {}
response['error'] = 'the task has been assigned to other roommate'
return self.respond(**response)
task.finished = True
task.put()
item_id = str(uuid.uuid4())
sharer_lst = task.candidate_lst
# sharer_lst.remove(task.charger_email) # newly removed this line
print("creating item ")
new_Item = Item(item_id = item_id, cover_url = str(task.photo_blobkey), expense_id = task.expense_id,
total_cost = total_cost,
buyer_email = task.charger_email,
sharer_email_lst = sharer_lst,
item_name = task.task_name)
new_Item.put()
expenses = Expense.query(Expense.expense_id == task.expense_id).fetch()
if len(expenses) == 0:
print("cannot find the expense");
else:
expense = expenses[0]
item_ids = expense.item_id_lst
item_ids.append(item_id)
expense.item_id_lst = item_ids
expense.put()
print("done ")
self.respond(item_name = task.task_name, item_id = task.task_id, status="Success")
示例3: get
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import query [as 别名]
def get(self):
tasks = Task.query().fetch()
tasks = [t.to_dct() for t in tasks]
self.response.write(json.dumps(tasks))
示例4: get
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import query [as 别名]
def get(self):
ndb.delete_multi(
Project.query().fetch(keys_only=True)
)
ndb.delete_multi(
Quest.query().fetch(keys_only=True)
)
ndb.delete_multi(
Task.query().fetch(keys_only=True)
)
project = Project(name="project 01", progress=0,
description="descricao", xp=100)
project.put()
quest = Quest(name="quest 01", description="description",
xp=30, deadline="2013-11-21",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
quest = Quest(name="quest 02", description="description",
xp=30, deadline="2013-12-10",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
quest = Quest(name="quest 03", description="description",
xp=30, deadline="2014-01-10",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
self.response.write("ok")