Admin Site (Django)
The Django admin is an automatically generated web interface for managing your models' data. By registering a model, you get ready-made pages to create, edit, search, and delete its rows — no extra code required.
Django
The admin is one of Django's headline features: a fully functional back-office out of the box. You register a model with admin.site.register(Post) (or the @admin.register decorator) and immediately get CRUD pages, permissions, and search for it at /admin/.
You customize it with a ModelAdmin class: list_display sets the columns shown in the list, list_filter adds sidebar filters, search_fields enables a search box, and inlines let you edit related objects on the same page. This makes a usable admin for staff with minimal effort.
The admin is meant for trusted staff, not end users — it is powerful and exposes your data model directly. Protect it (strong passwords, limited access) and build separate, purpose-built views for the public-facing site.
Syntax
@admin.register(Post)
class PostAdmin(admin.ModelAdmin): ...Examples
Python
from django.contrib import admin
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ("title", "author", "created")
list_filter = ("published",)
search_fields = ("title", "body")