Django Admin Site
Django Admin Site
One of Django's most celebrated "batteries-included" features is the Django Admin Site. It reads metadata from your models to automatically generate an enterprise-grade administrative dashboard for managing content, inspecting database records, and managing staff permissions. Customizing the admin site transforms it into a bespoke operations back-office.
1. Enabling the Admin and Creating a Superuser
Django Admin is enabled by default in INSTALLED_APPS via django.contrib.admin. To log in, generate an administrative superuser account:
Start the dev server and visit http://127.0.0.1:8000/admin/.
2. Registering Models with ModelAdmin
To expose your models in the admin, register them in admin.py:
3. Custom Admin Actions
You can add bulk action triggers to the admin dropdown menu:
4. Inlines: Editing Related Models on the Same Screen
When managing parent and child models (e.g. an Article and its Comments, or an Order and Line Items), TabularInline lets staff edit children directly inside the parent page:
Practice Quiz
User Model & Permissions
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
| Previous Lesson | Next Lesson |
|---|---|
| Migrations & ORM Queries | User Model & Permissions |
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.