Importing and Inspecting Models
Pull in models and look at their fields.
Bring Your Models In
Before you can query data, you import the model class into the shell. Pull it from the app where you defined it.
>>> from blog.models import PostThe App Path Pattern
The import path is always appname.models. So a Post in the blog app lives at blog.models, matching your folder layout.
All lessons in this course
- Launching python manage.py shell
- Importing and Inspecting Models
- Creating and Saving Objects Live
- shell_plus and Better Tooling