How to customize django admin with our own style?
We all know django has it own default admin panel for a project which look like this
But we don't want our admin panel of our project to be name as django administration we want to customize it with our own style like changing the color, background color, text everything we want to change it as per our project UI
So here you can do to change the django admin panel
Step1: Go to the template folder
Step2: Create a folder and name it as an admin so that it is easy for you to understand that this is the admin folder for our templates
Step3:Inside an admin folder create a file name as 'base_site.html' in order to make you understand that this file is a file which overwrite the base file.Django has it default base HTML file so in order to customize the admin panel we have to overwrite the base file.
Step4: run the server and go to to the admin panel and open developer tool by clicking inspect to see which one we want to customize.
We see that the django administration is inside the div which has an id "branding" so we have to access that div and overwrite the h1 tag with our customize text
Step 5:
In line1 we have to extends the default base.HTML of the Django admin
In line2 we have to load static if we are using a css which is not an inline CSS but here i use an inline css
Inline3 we access the branding id an we change the h1 tag text with our custom text
Inline6 i want to change the color and style of the admin panel so we have to use block extrastyle inside this block we can link our static CSS or we can write an inline style like i have did in this project.
Here is the result
Before:
After:
That it you make it, Drop a suggestion for me or any feedback i always welcome any feedback
Social link:
Istagram: https://www.instagram.com/co_dtechr/
Comments
Post a Comment