Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created November 25, 2013 21:28
Show Gist options
  • Save bogsio/7649211 to your computer and use it in GitHub Desktop.
Save bogsio/7649211 to your computer and use it in GitHub Desktop.
>>> 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