本文整理汇总了Python中models.Task.completed方法的典型用法代码示例。如果您正苦于以下问题:Python Task.completed方法的具体用法?Python Task.completed怎么用?Python Task.completed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.completed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_task_should_be_complete
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import completed [as 别名]
def test_task_should_be_complete(self):
"""
A Task should be able to completed via the ORM
"""
task = Task(description="Test")
self.assertFalse(task.completed)
task.completed = True
task.save()
fetched_task = Task.objects.filter(description="Test")[0]
self.assertTrue(fetched_task.completed)
示例2: save
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import completed [as 别名]
def save(self):
task = Task()
task.name = self.cleaned_data.get('name')
task.description = self.cleaned_data.get('description')
task.position = self.cleaned_data.get('position')
task.priority = self.cleaned_data.get('priority')
task.completed = self.cleaned_data.get('completed')
task.list = TaskList.objects.get(pk=self.cleaned_data['list_id'])
task.save()
示例3: testInsertEntity
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import completed [as 别名]
def testInsertEntity(self):
# Save Entity
t = Task()
t.description = "Hello World"
t.completed = True
t.put()
# Retrieve Entity
database_task = Task.query().fetch(20)
# Test retrieved entity
self.assertEqual(1, len(database_task))
self.assertEqual(True, database_task[0].completed)
self.assertEqual("Hello World", database_task[0].description)
示例4: save_task
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import completed [as 别名]
def save_task():
task = Task()
task.user_id = g.sql_session.query(User).filter_by(username=session.get('user')).first().id
task.completed = request.form['completed']
task.uncompleted = request.form['uncompleted']
task.coordination = request.form['coordination']
task.updated_time = datetime.now()
try:
g.sql_session.add(task)
g.sql_session.commit()
except Exception as e:
flash(str(e))
return redirect(url_for('.user_home'))
示例5: add_task_ajax
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import completed [as 别名]
def add_task_ajax(request, id):
"""
Simple routine to add a task to a project
TODO: finish this :)
"""
returnDict = {}
if request.method == 'POST':
try:
taskdict = json.loads(request.POST['datadict'])
task = Task()
task.completed = False
task.date_added = datetime.datetime.now()
task.title = taskdict['task_title']
task.description = taskdict['task_description']
task.save()
link = TaskToProject()
link.task = task
link.project = Project.objects.filter(id=id).get()
link.save()
returnDict['id'] = task.id
except Exception, e:
returnDict['error'] = e.message