Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Customizing the Django Admin

00:00 Customizing the Django Admin.

00:04 Django’s creators didn’t just build the admin—they did it in such a way that you can customize it for your projects. When you registered the PersonAdmin object earlier, it inherited from admin.ModelAdmin.

00:17 Most of the customization you can do with a Django admin is done by modifying ModelAdmin, and there’s a lot of modifying that can be done. ModelAdmin has over 30 attributes and almost 50 methods.

00:30 You can use each one of these to fine-tune the admin’s presentation and control your objects’ interfaces. Every one of these objects is described in detail in the documentation.

00:43 To top it all off, the admin is built using Django’s templating interface. The Django template mechanism allows you to override existing templates, and because the admin is just another set of templates, this means you can completely change the HTML.

00:58 Although it’s beyond the scope of this tutorial, you can even create multiple admin sites. That might seem like overkill, but it allows you to get fancy and define different sites for users with different permissions.

01:11 The Django admin is split into three major areas: The app index—this index lists your registered models. Change lists—a change list is automatically created for each registered model and lists the objects for that model. Change forms—when you add or edit one of these objects, you do so with a change form.

01:34 In the earlier example, the app index showed the Person, Course, and Grade objects. Clicking People shows the change list for Person objects. On the Person change list page, clicking the Buffy Summers object takes you to the change form to edit Buffy’s details. In the next video, you’ll see how to customize the admin, starting with list_display.

Become a Member to join the conversation.