本文整理汇总了Python中models.Task.select方法的典型用法代码示例。如果您正苦于以下问题:Python Task.select方法的具体用法?Python Task.select怎么用?Python Task.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fetch_history
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import select [as 别名]
def test_fetch_history():
url = 'https://www.zhihu.com/question/40103788/answer/124499334'
# query = (Page.select(Page, Task)
# .join(Task)
# .where((Task.page_type == 'zhihu_article') & (Page.title.contains('最前沿')))
# .group_by(Page.task)
# .having(Page.watch_date == fn.MAX(Page.watch_date))
# .limit(9999))
t = Task.select().where(Task.url == url).get()
for page in t.pages:
log(page.version)
log(page.title)
log(page.content)
示例2: get_task_or_404
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import select [as 别名]
def get_task_or_404(task_id, user):
try:
return Task.select().where(Task.id == task_id, Task.owner == user).get()
except (peewee.DoesNotExist, ) as e:
abort(404, 'Task not found.')
示例3: fetch
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import select [as 别名]
def fetch(self):
tasks = Task.select().where(Task.source==self.source, Task.title != '')
for task in tasks:
yield task
示例4: Task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import select [as 别名]
import datetime
from models import Board, List, Task
highest_order = Task.select().where(Task.belongs_to_list == 1).order_by(Task.task_order.desc()).get()
new_task = Task(
belongs_to_list=List.select().where(List.name == "Important List"),
task_name="Learn Rails",
task_description="I am trying to learn rails so I can build complex apps in the future and also my own api someday.",
task_order=(highest_order.task_order + 1),
)
new_task.save()
示例5: clear_task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import select [as 别名]
def clear_task():
task_list = Task.select()
for task in task_list:
task.delete_instance()