0PricingLogin
Django Academy · Lesson

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 Post

The 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

  1. Launching python manage.py shell
  2. Importing and Inspecting Models
  3. Creating and Saving Objects Live
  4. shell_plus and Better Tooling
← Back to Django Academy