本文整理汇总了Python中model.Task.category_id方法的典型用法代码示例。如果您正苦于以下问题:Python Task.category_id方法的具体用法?Python Task.category_id怎么用?Python Task.category_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Task
的用法示例。
在下文中一共展示了Task.category_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_encoder
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import category_id [as 别名]
def test_encoder(self):
p = Project('test')
p.id = 1
c = Category('test')
c.id = 2
c.project_id = p.id
t = Task('test')
t.id = 3
t.category_id = c.id
self.assertIsNotNone(json.dumps(p, cls=ModelEncoder))
self.assertIsNotNone(json.dumps(c, cls=ModelEncoder))
self.assertIsNotNone(json.dumps(t, cls=ModelEncoder))
示例2: test_delete_item
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import category_id [as 别名]
def test_delete_item(self):
j = JSon(config.backend_json['filename'])
t = Task('new task')
t.id = 3
t.category_id=1
key = 'Task.3'
j.delete_item(t)
j.commit()
self.assertNotIn(key, j.data.keys())
示例3: create_project_task
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import category_id [as 别名]
def create_project_task(self, project, category, name):
if project is None:
print('Invalid project')
return None
cat = self.get_category(project, category)
if cat is None:
cat = self.create_project_category(project, category)
if self.backend.item_exists(Task, {'name': name, 'category_id': cat.id}):
print('Task already exists')
return
task = Task(name)
task.category_id = cat.id
self.backend.add_item(task)
self.backend.commit()
return task