Registering Models with admin.site
Make your models editable in the admin.
Registering Models with admin.site is a free Django Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Django Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Empty Dashboard
Right now the admin only shows Users and Groups. To manage your own data you must register each model so the admin knows about it.
Where to Register
Each app has its own admin.py file. This is the one place you tell Django which models should appear in the admin.
Import the Tool
First bring in the admin module. The admin object is your gateway to registering models and customizing the site.
from django.contrib import adminImport Your Model
Next import the model you want to manage. Pull it in from your app's models module so admin.py can reference it.
from .models import PostRegister It
Now hand the model to the admin. Calling admin.site.register() adds that model straight onto the dashboard.
admin.site.register(Post)See It Appear
Refresh /admin and your model is now listed with built-in add, edit, and delete screens. No extra views needed. ✨
Register Many
Got several models? Just import each one and call register again. Every register call gives that model its own admin section.
admin.site.register(Author)
admin.site.register(Tag)The Decorator Way
There is a cleaner style too. The @admin.register decorator registers a model right above its admin class in one step.
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
passFriendly Names
The admin shows each row using the model's __str__ method. A good __str__ turns cryptic rows into readable labels.
def __str__(self):
return self.titleAlready Registered
Register the same model twice and Django raises AlreadyRegistered. Each model belongs to exactly one register call.
Restart Not Needed
The dev server auto-reloads when you save admin.py, so just refresh the page. Your newly registered model shows up instantly.
Quick Check
How do you make a model appear in the admin?
Recap
In admin.py you imported a model and registered it, and it appeared on the dashboard with full CRUD screens. That is the core admin workflow. 🎉
Frequently asked questions
Is the “Registering Models with admin.site” lesson free?
Yes — the full text of “Registering Models with admin.site” is free to read here on the web, and the Django Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Django Academy course, upgrade to CoddyKit PRO.
What will I learn in “Registering Models with admin.site”?
Make your models editable in the admin. You practise Django Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Django Academy?
No prior experience is required. Django Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Registering Models with admin.site” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Django Academy lesson?
Yes. Every Django Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- createsuperuser and Logging In
- Registering Models with admin.site
- Customizing ModelAdmin
- Inlines and Readonly Fields