MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Django Admin Site0%
Study Materials
Django for Backend DevelopmentProgress 0%
1.1Installing Django & Environment Setup1.2Django Project Structure1.3Creating First Django App
3.1Django Admin Site3.2User Model & Permissions3.3Groups and Roles
HomeTutorialsDjango for Backend DevelopmentDjango Admin Site
User Model & Permissions

Django Admin Site

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

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:

1python manage.py createsuperuser
2# Prompt: Username, Email, Password

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:

1# articles/admin.py
2from django.contrib import admin
3from .models import Article, Category, Tag
4 
5# Simple registration:
6admin.site.register(Category)
7admin.site.register(Tag)
8 
9# Advanced customized registration:
10@admin.register(Article)
11class ArticleAdmin(admin.ModelAdmin):
12 # 1. Columns displayed in the record list view
13 list_display = ("title", "author", "status", "category", "view_count", "created_at")
14
15 # 2. Clickable columns linking to the detail change form
16 list_display_links = ("title",)
17
18 # 3. Sidebar filtering widgets
19 list_filter = ("status", "category", "created_at", "is_featured")
20
21 # 4. Search bar querying specified fields
22 search_fields = ("title", "content", "author__username")
23
24 # 5. Automatically populate slug field based on title input in real-time
25 prepopulated_fields = {"slug": ("title",)}
26
27 # 6. Pagination count per page
28 list_per_page = 25
29
30 # 7. Form field groupings and layouts
31 fieldsets = (
32 ("General Information", {
33 "fields": ("title", "slug", "author", "category")
34 }),
35 ("Content Body", {
36 "fields": ("content",)
37 }),
38 ("Publication Settings", {
39 "classes": ("collapse",), # Collapsible section
40 "fields": ("status", "is_featured", "tags")
41 }),
42 )

3. Custom Admin Actions

You can add bulk action triggers to the admin dropdown menu:

1@admin.register(Article)
2class ArticleAdmin(admin.ModelAdmin):
3 actions = ["make_published", "make_archived"]
4 
5 @admin.action(description="Mark selected articles as Published")
6 def make_published(self, request, queryset):
7 updated_count = queryset.update(status="published")
8 self.message_user(
9 request,
10 f"Successfully marked {updated_count} articles as published."
11 )
12 
13 @admin.action(description="Mark selected articles as Archived")
14 def make_archived(self, request, queryset):
15 queryset.update(status="archived")

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:

1class CommentInline(admin.TabularInline):
2 model = Comment
3 extra = 1 # Number of empty blank rows to display
4 
5@admin.register(Article)
6class ArticleAdmin(admin.ModelAdmin):
7 inlines = [CommentInline]

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What command creates an administrative user capable of logging into /admin/?
Question 2
What does the prepopulated_fields option do in ModelAdmin?
Question 3
How do you add searchable columns to the Django Admin change list?
Question 4
What is the purpose of admin.TabularInline?
Question 5
Why is list_filter = ("status", "category") useful on high-volume models?
Next Lesson

User Model & Permissions

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Migrations & ORM QueriesUser Model & Permissions

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Django for Backend Development with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext