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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Models, routing, views, and templates3m 55s
-
(Locked)
Django models1m 19s
-
(Locked)
Django fields3m 46s
-
(Locked)
Implement model and fields5m 24s
-
(Locked)
Django migrations6m 5s
-
(Locked)
Import CSV data6m 24s
-
(Locked)
Work with the Django admin7m 18s
-
(Locked)
Query data with the Django ORM6m 42s
-
-
-
-