当前位置: 首页>>代码示例>>Python>>正文


Python Task.completed方法代码示例

本文整理汇总了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)
开发者ID:freyes,项目名称:django-todo,代码行数:12,代码来源:tests.py

示例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()
开发者ID:imanoleizaguirre,项目名称:mytasks,代码行数:12,代码来源:forms.py

示例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)
开发者ID:py-yyc,项目名称:todos_app,代码行数:17,代码来源:tests.py

示例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'))
开发者ID:ysrotciv,项目名称:dailytask,代码行数:18,代码来源:route.py

示例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
开发者ID:daubers,项目名称:MakeBook,代码行数:26,代码来源:views.py


注:本文中的models.Task.completed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。