The ORM in the Shell
The shell lets you try the ORM. Create objects with the constructor and save, or use objects.create. Every model has the manager objects.
Example
python manage.py shell
>>> from blog.models import Post
>>> p = Post(title="Hello", body="First post")
>>> p.save()
>>> Post.objects.create(title="Second", body="More")
>>> Post.objects.count()
2Exercise
Save an object.
p.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.