🎸 Django Beginner

What is the Django admin interface?

Answer

Django's admin interface is an automatically generated, fully functional CRUD web interface for managing your application's data — one of Django's most celebrated features. It comes for free just by registering your models. Enabling admin: django.contrib.admin is included by default. Visit /admin/. Create a superuser: python manage.py createsuperuser. Registering a model: basic: admin.site.register(Article). Custom admin class: @admin.register(Article) class ArticleAdmin(admin.ModelAdmin): list_display = ("title", "author", "published_at", "is_published") list_filter = ("is_published", "author") search_fields = ("title", "content") list_editable = ("is_published",) date_hierarchy = "published_at" ordering = ("-published_at",) readonly_fields = ("created_at", "updated_at") fieldsets = ( ("Content", {"fields": ("title", "content")}), ("Publishing", {"fields": ("author", "is_published", "published_at"), "classes": ("collapse",)}) ) actions = ["make_published"] def make_published(self, request, queryset): queryset.update(is_published=True). Features: list view with sorting/filtering/search; detail edit view; inline related objects; bulk actions; history/audit log; pagination; customizable themes. Security: admin requires staff permission (is_staff=True). Fine-grained permissions per model (add, change, delete, view). Restrict to specific IP: use middleware or deploy on a separate port. Change default URL: admin.site.urls can be remapped.