

{"id":71663,"date":"2019-11-01T14:41:35","date_gmt":"2019-11-01T09:11:35","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=71663"},"modified":"2021-06-21T12:19:16","modified_gmt":"2021-06-21T06:49:16","slug":"django-admin-customization","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/","title":{"rendered":"Django Admin Customization &#8211; Step-by-step tutorial for novice learners"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1348,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/open?id=1NNKLFACStEMHJaW2b8gwP9lIeG2XwQhh&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1NNKLFACStEMHJaW2b8gwP9lIeG2XwQhh\\\/view?usp=drive_open&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Django Admin is one of the most important tools of Django. It\u2019s a full-fledged application with all the utilities a developer need. Django Admin\u2019s task is to provide an interface to the admin of the web project. Django\u2019s Docs clearly state that Django Admin is not made for frontend work.<\/p>\n<p>Although, we all have used Django Admin and its interface is very user-friendly.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71787 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin.png\" alt=\"Django Admin - Django Admin Customization\" width=\"1920\" height=\"948\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-768x379.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1024x506.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-520x257.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Django Admin\u2019s aim is to provide a user interface for performing CRUD operations on user models and other functionalities like authentication, user access levels, etc. These all are functions that make admin more productive. We have a separate tutorial, which explains these functions.<\/p>\n<p>This tutorial on Django Admin customization is aimed at more advanced users. It will provide you knowledge of how the admin interface is customizable, how we can add and change particular things in the admin. This modification may make it more productive according to the use-case.<\/p>\n<p>So, let\u2019s get started. I am simply making a new application in an existing Django project. All the steps of implementation will be there. You can find this blog\u2019s project files here:<\/p>\n<p><a href=\"https:\/\/drive.google.com\/open?id=1NNKLFACStEMHJaW2b8gwP9lIeG2XwQhh\">DataFlair Admin<\/a><\/p>\n<h3>Django Admin Customization<\/h3>\n<p>We will be customizing some parts of the Django Admin. This customization will provide us with a better representation of objects. To implement it in your project, make a new app in your Django project named <strong>products<\/strong>.<\/p>\n<p><strong>Command:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py startapp products<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72076 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1.png\" alt=\"Django Admin startapp\" width=\"1920\" height=\"972\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1-300x152.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1-768x389.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1-1024x518.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-startapp-1-520x263.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Install this application, type <strong>product<\/strong> in the\u00a0<strong>INSTALLED_APPS<\/strong> list in <strong>settings.py<\/strong> file.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71794\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py.png\" alt=\"settings.py - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/settings-py-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We will now make models in the products app. The model will be used throughout the tutorial to customize the Django Admin.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.db import models\r\n\r\n#DataFlair\r\nclass Product(models.Model):\r\n    name = models.CharField(max_length = 200)\r\n    description = models.TextField()\r\n    mfg_date = models.DateTimeField(auto_now_add = True)\r\n\r\n    def __str__(self):\r\n        return self.name\r\n\r\n    def show_desc(self):\r\n        return self.description[:50]<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71795\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py.png\" alt=\"models.py - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/models-py-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, we need to migrate these changes to the database. For that, execute these commands in order.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\u00a0python manage.py makemigrations\r\n\u00a0python manage.py migrate<\/pre>\n<p>We need to register these models on the Django Admin. To do this, edit the <strong>products\/admin.py<\/strong> file. Paste this code after clearing the file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.contrib import admin\r\nfrom .models import Product\r\n\r\n# Register your models here.\r\n# DataFlair\r\n\r\nadmin.site.register(Product)<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71796\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin.png\" alt=\"Registering on Django Admin - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Registering-on-Django-Admin-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We also need a superuser to access the admin. You can skip this part if you already have a superuser account.<\/p>\n<p>To make a superuser in Django Admin, execute this command.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\u00a0python manage.py createsuperuser<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72087\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1.png\" alt=\"createsuperuser command - Django Admin Customization\" width=\"948\" height=\"350\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1.png 948w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1-150x55.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1-300x111.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1-768x284.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/createsuperuser-command-1-520x192.png 520w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/a><\/p>\n<p>The password won\u2019t be displayed while you type. In the image, you can not see anything in front of password fields. After successfully creating a superuser, start your server.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py runserver<\/pre>\n<p>Now, we can start playing with Django Admin. Search this URL in your browser:<\/p>\n<p><em>http:\/\/localhost:8000\/admin\/<\/em><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71798 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1.png\" alt=\"Django Admin\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-1-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We will make a lot of changes to this panel.<\/p>\n<p><strong>1. Register\/ Unregister models from admin<\/strong><\/p>\n<p>We can register models in admin easily. We have used the register method to register models in the admin. But, what to do for unregistering models?<\/p>\n<p>A valid point of the argument is that you simply don\u2019t register the model. Yes, that\u2019s true. What if we want to remove default models like Groups, Users from admin? The answer is <strong>unregister method<\/strong>.<\/p>\n<p>Let\u2019s see how to unregister the model.<\/p>\n<p>Open, <strong>products\/admin.py<\/strong> file and paste this code in it.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.contrib import admin\r\nfrom django.contrib.auth.models import Group\r\nfrom .models import Product\r\n\r\n# Register your models here.\r\n# DataFlair\r\n\r\nadmin.site.register(Product)\r\nadmin.site.unregister(Group)<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71799\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py.png\" alt=\"products\/admin.py - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-admin-py-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, simply reload your server and open the admin panel. You will see that the <strong>Group<\/strong> model is not there.<\/p>\n<p><strong>Understanding the code:<\/strong><\/p>\n<p>The file is mostly identical, except two lines that are added in this picture. The <strong>2nd line<\/strong> is where we import the <strong>Group<\/strong> model. Then we simply unregister the <strong>Group<\/strong> model in the <strong>9th line<\/strong>.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71800 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models.png\" alt=\"Django Admin after unregistering models - Django Admin Customization \" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-after-unregistering-models-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>2. Changing the title of Django Admin<\/strong><\/p>\n<p>There are so many parts that can be changed from the front-end perspective. Like you can change the title written in the top-left corner of the web-page. <strong>Django administration<\/strong> can be changed to anything you like.<\/p>\n<p>Add this line in <strong>products\/admin.py<\/strong> file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">admin.site.site_header = \"DataFlair Django Tutorials\"<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71801\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header.png\" alt=\"admin.site.site_header - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/admin.site_.site_header-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>You can assign any string value you like. Just put the value in this variable.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71802 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header.png\" alt=\"Updated Header - django admin panel\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Updated-Header-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>There is much more to the customization of UI. It&#8217;s ultimately for you to decide, whether you want this heavily customized or make admin for yourself.<\/p>\n<p><strong>3. ModelAdmin Class<\/strong><\/p>\n<p>The ModelAdmin class is a representation of user-defined models in the admin panel. It can be used to override various actions. There is a whole range of options opened with ModelAdmin Class.<\/p>\n<p>We have to register the Admin Model alongside the model we want to change. Suppose, we want to exclude some fields to not be shown on the admin panel.<\/p>\n<p>We can do that by simply adding these lines in<strong> products.admin.py<\/strong> file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># ModelAdmin Class # DataFlair\r\nclass ProductA(admin.ModelAdmin):\r\n    exclude = ('description', )<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71803\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12.png\" alt=\"Model Admin Class\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Custom-Image-12-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>We simply make the ModelAdmin class. This class is used to override the default class views. These default views are those which are created by an admin. We can think of the ModelAdmin class which is always generated by an admin.<\/p>\n<p>When we register our models in admin.py, it was automatically generated. We just use it so to make changes or override the default class. One of the variables we can use is excluded. This variable takes tuple, list as input.<\/p>\n<p>You can specify the fields you want to exclude in the admin view. They will not be deleted from the database. They will not be displayed in the admin panel to input.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71804 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field.png\" alt=\"Admin Panel without description field - Django Admin Customization\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Admin-Panel-without-description-field-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>As you can see, the <strong>description<\/strong> field is not available for input. The ModelAdmin takes a lot of things.<\/p>\n<p><strong>4. Customizing List Display in Django Admin<\/strong><\/p>\n<p>You should add some products before we check out this one. Populate your database with 5-6 products. After you have added some products, open the products model from the admin panel. There you will see a list of Product objects. It only shows the names of the products like in the image.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71805 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products.png\" alt=\"List view with names of products - Django Admin Customization\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-of-products-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>There are many scenarios where one might want more information visible in the list view. We can see all the information in the database. Similarly, we can choose the fields we want in the admin panel. To change the list view, modify your <strong>products\/admin.py<\/strong> as seen in the image.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list_display = ('name', 'description')<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71806\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification.png\" alt=\"List_display modification - django admin register\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_display-modification-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>The list view will now display both <strong>name<\/strong> &amp; <strong>description<\/strong>\u00a0fields.<\/p>\n<p>The<strong> list_display<\/strong> variable takes a list or tuple as input. You can provide the names of fields you want it to display.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71811 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1.png\" alt=\"List view with names and description fields - Django Admin Customization\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List-view-with-names-and-description-fields-1-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>You can add more fields according to your use case. It is recommended that you keep only the necessary information in the admin panel. We have an efficient database to view the whole data. It&#8217;s just a good practice to keep only necessary data in admin.<\/p>\n<p><strong>5. Adding a filter in admin<\/strong><\/p>\n<p>How easy it would be to be able to filter objects. When dealing with a large database, it becomes necessary to see selected information. To perform that task easier, we can add a filter in the list view of the admin panel.<\/p>\n<p>Modify the<strong> products\/admin.py<\/strong> file as in Image.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list_filter = ('mfg_date', )<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71809\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization.png\" alt=\"List_filter customization - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/List_filter-customization-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Here, we simply mentioned the fields we wanted a filter for. You can add multiple fields at a time in the <strong>list_filter<\/strong> variable. It takes in the list as input. After adding the field name, the admin list_view changes to this.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-71815 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter.png\" alt=\"Django Admin list_filter - Django Admin Customization\" width=\"1920\" height=\"943\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter-300x147.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter-768x377.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter-1024x503.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-list_filter-520x255.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, we can classify objects on the basis of date. Django provides options like today, past 7 days, etc. to the panel. It&#8217;s so handy and user-friendly.<\/p>\n<h3>Django Admin Actions<\/h3>\n<p>The admin actions are functions that can modify collective data easily. In this image below, deleting multiple objects is fairly easy. That is the utility of actions. Not just that, actions can do much more. We will also make some actions of our own.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-72078 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products.jpg\" alt=\"Admin Action - delete selected products - Django Admin Customization\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products.jpg 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products-150x80.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products-300x161.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products-768x412.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products-1024x549.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Admin-Action-delete-selected-products-520x279.jpg 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, suppose we have a rating system for our products. We have three kinds of ratings, bad, good and excellent.<\/p>\n<p>We are first going to edit <strong>products\/models.py<\/strong> file. Add this code according to the image.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.db import models\r\n\r\nRating = [\r\n    ('b', 'Bad'),\r\n    ('a', 'Average'),\r\n    ('e', 'Excellent')\r\n]\r\n\r\n#DataFlair\r\nclass Product(models.Model):\r\n    name = models.CharField(max_length = 200)\r\n    description = models.TextField()\r\n    mfg_date = models.DateTimeField(auto_now_add = True)\r\n    rating = models.CharField(max_length = 1, choices = Rating)\r\n    def __str__(self):\r\n        return self.name\r\n\r\n    def show_desc(self):\r\n        return self.description[:50]<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71818\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py.png\" alt=\"products\/models.py - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/products-models-py-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, execute the commands as shown in the next image.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72081 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute.png\" alt=\"Commands to execute - Django Admin Customization\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Commands-to-execute-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>These commands shall be executed in this order. I have highlighted the commands in the yellow rectangles. Also, highlighted the front of those commands. These commands are necessary as we are making changes to the models. In the above code, we added a dropdown for product objects.<\/p>\n<p>Since we already have some objects in the database, Django asks us to assign a default value to them. We assign the value in the third highlighted box. That\u2019s it. After you have done these things and started the server again proceed further.<\/p>\n<p>For any queries regarding the Django Admin customization tutorial please post comments below. Also, there is a GitHub repository for this project.<\/p>\n<p>We will now, edit <strong>products\/admin.py<\/strong> file. Add this code according to the image.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.contrib import admin\r\nfrom django.contrib.auth.models import Group\r\nfrom .models import Product\r\n\r\n# Admin Action Functions\r\ndef change_rating(modeladmin, request, queryset):\r\n    queryset.update(rating = 'e')\r\n\r\n# Action description\r\nchange_rating.short_description = \"Mark Selected Products as Excellent\"\r\n\r\n# ModelAdmin Class # DataFlair\r\nclass ProductA(admin.ModelAdmin):\r\n    list_display = ('name', 'description', 'mfg_date', 'rating')\r\n    list_filter = ('mfg_date', )\r\n    actions = [change_rating]\r\n\r\n# DataFlair\r\nadmin.site.register(Product, ProductA)\r\nadmin.site.unregister(Group)\r\n\r\n# DataFlair # Changing Admin header\r\nadmin.site.site_header = \"DataFlair Django Tutorials\"<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-71822\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions.png\" alt=\"Django Admin Actions - Django Admin Customization\" width=\"1920\" height=\"976\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions-150x76.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions-300x153.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions-768x390.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions-1024x521.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/10\/Django-Admin-Actions-520x264.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understanding the Code:<\/strong><\/p>\n<p>Here, we are adding an action in Django Admin. First, we need a function that will be executed when the action is called. Generally, that action function will take 3 arguments; <strong>Request, Queryset, and modeladmin class<\/strong>.<\/p>\n<p>From the code, we made a function <strong>change_rating()<\/strong> and passed these 3 parameters.<\/p>\n<p>The function will update the field <strong>rating<\/strong> to value <strong>e<\/strong> for selected Queryset. The Queryset is nothing but the list of selected objects. Now, we come out of function and define a description for it. The description is visible as an option in the <strong>Actions<\/strong> tab in the admin panel.<\/p>\n<p>Then we add the action in <strong>actions<\/strong> member of <strong>ProductA<\/strong> class. Save the code and the server will auto-reload.<\/p>\n<p>Now, just reload the <strong>admin\/products<\/strong> page. You will get this new action.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-72082 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action.jpg\" alt=\"Django Admin Action\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action.jpg 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action-150x80.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action-300x161.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action-768x412.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action-1024x549.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/Django-Admin-Action-520x279.jpg 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Try and play with some more customizations. Django Admin is a very productive tool and very beginner-friendly.<\/p>\n<h3>Summary<\/h3>\n<p>The conclusion to this Django Admin customization tutorial is what a great tool admin is. Although, we have not gone to fully customize the Django Admin. The reason for not doing complete customization is wasting time. You see, you need to learn in-depth if you want an admin to be fully customized.<\/p>\n<p>Django Admin is not meant to be customized that deeply and the official docs are also clear about that. Although, there are more customizations available. We only need to customize enough such that it saves time and doesn\u2019t raise any unknown exceptions.<\/p>\n<p>Django Admin is a tool to increase productivity and is meant only for admin.<\/p>\n<p>There are custom skins available for Django Admin. They are also very fine-tuned. There is a catch that every time Django is updated, there are slight changes to the admin too. This raised bugs in our code if we have a highly customized admin.<\/p>\n<p>Therefore, for deep customization or heavy tasks for your websites, you should make your own admin panel. For simple management and CRUD operations, Admin is fairly customizable and capable.<\/p>\n<p><em>Any queries in the Django Admin Customization Tutorial? Share them in the comment section.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django Admin is one of the most important tools of Django. It\u2019s a full-fledged application with all the utilities a developer need. Django Admin\u2019s task is to provide an interface to the admin of&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":72089,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19149],"tags":[21355,21356,21354,21358,21357],"class_list":["post-71663","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","tag-django-admin","tag-django-admin-actions","tag-django-admin-customization","tag-django-admin-filter","tag-django-create-superuser"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Django Admin Customization - Step-by-step tutorial for novice learners - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn the process of Django admin customization by making a new app in your Django project in easy steps and implement Django admin actions with code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/django-admin-customization\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Django Admin Customization - Step-by-step tutorial for novice learners - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn the process of Django admin customization by making a new app in your Django project in easy steps and implement Django admin actions with code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/django-admin-customization\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-01T09:11:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-21T06:49:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Django Admin Customization - Step-by-step tutorial for novice learners - DataFlair","description":"Learn the process of Django admin customization by making a new app in your Django project in easy steps and implement Django admin actions with code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/","og_locale":"en_US","og_type":"article","og_title":"Django Admin Customization - Step-by-step tutorial for novice learners - DataFlair","og_description":"Learn the process of Django admin customization by making a new app in your Django project in easy steps and implement Django admin actions with code.","og_url":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-11-01T09:11:35+00:00","article_modified_time":"2021-06-21T06:49:16+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Django Admin Customization &#8211; Step-by-step tutorial for novice learners","datePublished":"2019-11-01T09:11:35+00:00","dateModified":"2021-06-21T06:49:16+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/"},"wordCount":1751,"commentCount":5,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg","keywords":["django admin","django admin actions","Django Admin Customization","django admin filter","django create superuser"],"articleSection":["Django Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/django-admin-customization\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/","url":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/","name":"Django Admin Customization - Step-by-step tutorial for novice learners - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg","datePublished":"2019-11-01T09:11:35+00:00","dateModified":"2021-06-21T06:49:16+00:00","description":"Learn the process of Django admin customization by making a new app in your Django project in easy steps and implement Django admin actions with code.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/django-admin-customization\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/11\/django-admin-customization.jpg","width":802,"height":420,"caption":"django admin customization"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/django-admin-customization\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Django Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/django\/"},{"@type":"ListItem","position":3,"name":"Django Admin Customization &#8211; Step-by-step tutorial for novice learners"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=71663"}],"version-history":[{"count":14,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71663\/revisions"}],"predecessor-version":[{"id":97562,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/71663\/revisions\/97562"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/72089"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=71663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=71663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=71663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}