Customizing the Django Panel: A Step-By-Step Guide

In this guide I’ll walk you through how to modify and extend Django default admin panel/interface, making it more user-friendly.

1. Set up the Project:

Start by creating a brand new project and app in Django

django-admin startproject myprojectname


This content originally appeared on DEV Community and was authored by Digvijay Singh Rajput

In this guide I'll walk you through how to modify and extend Django default admin panel/interface, making it more user-friendly.

1. Set up the Project:

Start by creating a brand new project and app in Django

django-admin startproject myprojectname
cd myprojectname
python manage.py startapp developerscommunity

** Note**
Do not forgot to add your app ti the INSTALLED_APPS in settings.py

2. Run migrations:

python manage.py makemigrations
python manage.py migrate

3. Resgister Models in Admin Panel:

 Register of models is compulsory to see it in django admin 
 interface

  from django.contrib import admin
  from .models import DevCommunity

 admin.site.register(DevCommunity)

Above Steps will lead you to Django Admin Panel Now comes the customization part

4. Customize the Admin Panel:

class CustomAdminSite(admin.AdminSite):

will appear at the top-left corner

site_header = "Dev Admin"

will show in the browser tab

site_title = Developer Admin Portal

will be displayed on the admin home page.

index_title = "Welcome to Developer Community"

custom_admin_site = CustomAdminSite(name="dev_admin")

  #All code at one place
  class CustomAdminSite(admin.AdminSite):
     site_header = "Dev  Admin"
     site_title = Developer Admin Portal
     index_title = "Welcome to Developer Community"

  custom_admin_site = CustomAdminSite(name="dev_admin")

5. To register:

  #Finally register
  custom_admin_site.register(DevCommunity)

Image description


This content originally appeared on DEV Community and was authored by Digvijay Singh Rajput


Print Share Comment Cite Upload Translate Updates
APA

Digvijay Singh Rajput | Sciencx (2024-09-18T17:17:12+00:00) Customizing the Django Panel: A Step-By-Step Guide. Retrieved from https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/

MLA
" » Customizing the Django Panel: A Step-By-Step Guide." Digvijay Singh Rajput | Sciencx - Wednesday September 18, 2024, https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/
HARVARD
Digvijay Singh Rajput | Sciencx Wednesday September 18, 2024 » Customizing the Django Panel: A Step-By-Step Guide., viewed ,<https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/>
VANCOUVER
Digvijay Singh Rajput | Sciencx - » Customizing the Django Panel: A Step-By-Step Guide. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/
CHICAGO
" » Customizing the Django Panel: A Step-By-Step Guide." Digvijay Singh Rajput | Sciencx - Accessed . https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/
IEEE
" » Customizing the Django Panel: A Step-By-Step Guide." Digvijay Singh Rajput | Sciencx [Online]. Available: https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/. [Accessed: ]
rf:citation
» Customizing the Django Panel: A Step-By-Step Guide | Digvijay Singh Rajput | Sciencx | https://www.scien.cx/2024/09/18/customizing-the-django-panel-a-step-by-step-guide/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.