From the course: Learning Django

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Work with the Django admin

Work with the Django admin

From the course: Learning Django

Start my 1-month free trial

Work with the Django admin

- [Instructor] Now that we have data to work with, I'd like to use the Django admin to create an administrative interface for our project so that admin users can see and edit their data. First, we'll open our text editor and expand the wisdom pets folder, and then the adoptions app folder, and double-click the admin.py file. The first line of this file imports the admin module which we'll need. On line three, we'll remove this comment. Now, we need to import our pet model which is in the same folder so we'll use: from .models import Pet. To make an admin interface for our pet model, we'll create a class and we'll call it PetAdmin. Now, we'll need to make this class inherit from admin.ModelAdmin. This class can take several attributes and method overrides to modify its behavior. For now, we won't override anything just yet. So to make this a valid Python class, we'll just use the pass keyword. Next, we need to…

Contents