本文整理汇总了Python中models.Todo.text方法的典型用法代码示例。如果您正苦于以下问题:Python Todo.text方法的具体用法?Python Todo.text怎么用?Python Todo.text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Todo
的用法示例。
在下文中一共展示了Todo.text方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAlterTodo
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import text [as 别名]
def testAlterTodo(self):
todo = Todo()
todo.text = "Get some milk"
todo.timestamp = datetime.now()
todo.save()
assert not todo.completed
todo.completed = True
todo.save()
assert todo.completed
示例2: testAlterAndQueryTodo
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import text [as 别名]
def testAlterAndQueryTodo(self):
todo = Todo()
todo.text = "Get some milk"
todo.timestamp = datetime.now()
todo.save()
id = todo.id
assert Todo.objects.filter(completed=False).count() == 1
todo = Todo.objects.get(id=id)
todo.completed = True
todo.save()
assert Todo.objects.filter(completed=False).count() == 0
示例3: testAddTodo
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import text [as 别名]
def testAddTodo(self):
todo = Todo()
todo.text = "Get some milk"
todo.timestamp = datetime.now()
todo.save()
示例4: testAddTodoNoTimestamp
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import text [as 别名]
def testAddTodoNoTimestamp(self):
todo = Todo()
todo.text = "Get some milk"
todo.save()
示例5: setUp
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import text [as 别名]
def setUp(self):
for x in range(0, 23):
todo = Todo()
todo.text = "Item: %s" % x
todo.save()