本文整理汇总了Python中models.Job.all方法的典型用法代码示例。如果您正苦于以下问题:Python Job.all方法的具体用法?Python Job.all怎么用?Python Job.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
def get(self, job_id):
job = Job.get_by_key_name(job_id)
if job and job.state != DONE and job.active == True:
job.updated_at = datetime.now()
job.state = DONE
job.put()
# update the email
email = job.email
email.updated_at = datetime.now()
email.put()
# count the number of jobs attached to this flyer
job_query = Job.all()
job_query.filter("flyer =", job.flyer)
job_query.filter("active =", True)
total_jobs = job_query.count()
# count the number of jobs done so far
job_query = Job.all()
job_query.filter("flyer =", job.flyer)
job_query.filter("active =", True)
job_query.filter("state =", DONE)
done_jobs = job_query.count()
# write out
self.response.out.write(template.render("templates/finish.html",
{"total": total_jobs,
"done": done_jobs}))
else:
self.error(404)
示例2: get
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
def get(self, email):
q = Job.all()
q.filter("email =", urllib.unquote(email))
jobs = q.fetch(BOUND)
for job in jobs:
job.delete()
self.response.out.write(template.render("templates/sorry.html", {}))
示例3: post
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
def post(self, job_id):
job = Job.get_by_key_name(job_id)
# make sure the job is recent
if not(job.active):
self.error(404)
email = job.email
email.enable = False
email.updated_at = datetime.datetime.now()
email.put()
# find the email-club join
join_query = EmailToClub.all()
join_query.filter("email =", email)
joins = join_query.fetch(20)
# do the delete
for join in joins:
join.enable = False
join.updated_at = datetime.now()
join.put()
# mark all the jobs inactive
job_query = Job.all()
job_query.filter("email =", email)
job_query.filter("active =", True)
jobs = job_query.fetch(20)
for job in jobs:
job.active = False
job.put()
self.response.out.write(template.render("templates/sorry.html", {}))
示例4: get
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
def get(self):
t = list(time.localtime())
t[2] -= 31
dt = datetime.fromtimestamp(time.mktime(t))
jobs = Job.all()
jobs.filter("date <", dt)
jobs = jobs.fetch()
for job in jobs:
job.delete()
self.response.out.write(template.render("templates/task.html",
{"msg": "Removed old ones"}))
示例5: get
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
def get(self):
jobs = Job.all().order("title").fetch(MAX_FETCH_LIMIT)
job_list = []
for item in jobs:
job_list.append(item.to_json_dict("title", "is_starred", "is_active", "is_deleted", "when_created"))
self.response.out.write(json.dumps(job_list))