django admin
No account is required. Learn the material, try the examples, and mark it complete when you are ready to move on. Sign in with email only if you want to save progress across devices.
Tutorial 11 - Django Admin
Why this matters
A founder may need to manage application data without you building a complete custom dashboard.
Django Admin provides a ready-made interface for registered models.
1. Register a model
Suppose:
class Booking(models.Model):
name = models.CharField(max_length=100)
date = models.DateField()In admin.py:
from django.contrib import admin
from .models import Booking
admin.site.register(Booking)The important line is:
admin.site.register(Booking)You are telling Django:
Make this model available through the administration interface.
2. Create a superuser
Run:
python manage.py createsuperuserDjango asks for a username, email, and password.
When typing the password, the terminal does not show characters. That is normal.
3. Open Admin
Start:
python manage.py runserverVisit:
http://127.0.0.1:8000/admin/Log in.
Your registered models should appear.
4. Where is the booking actually stored?
The admin is not the database.
The database stores the record.
The relationship is:
Customer-facing application
↓
Database
↑
AdminBoth interfaces work with the same underlying data.
5. Why this is useful for an MWP
Imagine your application is a booking website.
Customers use:
/services/
/book/
/contact/The founder can use:
/admin/to manage:
Bookings
Customers
ServicesYou can therefore create a useful internal workflow without first building a custom dashboard.
6. Admin is not the public application
Do not confuse:
/admin/with:
/
/booking/
/products/Admin is primarily for trusted administrators.
7. Customizing the list
You may later use:
@admin.register(Booking)
class BookingAdmin(admin.ModelAdmin):
list_display = (
"name",
"date",
)You may also encounter:
list_filter
search_fields
orderingThese are conveniences for managing data.
Learn them when a project needs them.
8. Admin and permissions
Django supports users and permissions.
Not every user should necessarily be able to edit every record.
This becomes more important when authentication and authorization are introduced.
9. Exercise
In a booking project:
- register
Booking - create a superuser
- start Django
- open
/admin/ - create a booking through the public site
- find it in Admin
- edit it in Admin
- refresh the public application
You should observe the same database record from two interfaces.
10. Using ChatGPT
Ask:
I registered my Booking model in Django Admin. Explain why it appears there and how the model, admin, and database are connected.
Then:
Show me how to make the booking list easier for an administrator to search, explaining each option before adding it.
Remember
Database
↑ ↑
│ │
Application AdminOne database can support multiple interfaces.
Finished this lesson?
Keep your place here, or save it across devices with an email link.
Saved in this browser. Save progress with email →