Created
November 25, 2013 21:28
-
-
Save bogsio/7649211 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from todolist.models import TodoList, TodoItem | |
>>> from django.contrib.auth.models import User | |
>>> author = User.objects.get(username='bogdan') | |
>>> author | |
<User: bogdan> | |
>>> l1 = TodoList(name='My first TODO list', author=author) | |
>>> l1 | |
<TodoList: TodoList object> | |
>>> l1.save() | |
>>> l1 | |
<TodoList: TodoList object> | |
>>> item1 = TodoItem(text="Learn TastyPie", todo_list=l1) | |
>>> item1.save() | |
>>> item1 | |
<TodoItem: TodoItem object> | |
>>> item2 = TodoItem(text="Finish this tut", todo_list=l1) | |
>>> item2.save() | |
>>> l1.items.all() | |
[<TodoItem: TodoItem object>, <TodoItem: TodoItem object>] | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment