How to create admin panel in django 3

Hello World, Welcome to projectsplaza.com. Today I am going to create a tutorial about the Django admin panel. In this tutorial, we will learn how to create an admin panel in Django 3. I will extend my previous tutorial in which we have learned how we can submit form data in the SQLite database with jquery ajax in Django 3.

Django comes with a powerful admin panel. We just need to configure this in our project. There are lots of features in this admin panel but not any then you can customize it at any level.


Set up admin panel in learning project

In this step, we will create a superuser who can access all features of the admin panel.

  • Run this command to create superuser py manage.py createsuperuser
  • Open http://127.0.0.1:8000/admin

Register model in the admin panel

In this step, We will register the model in the admin panel. It means we can add, update and delete the model data via admin panel. We have created a post model in the learning project and now we will register this model in the admin.

  • Open learning/ajaxform/admin.py
  • Add the following code in this file.
from .models import Post
admin.site.register(Post)

Refresh the admin panel. You will see the Posts model under ajaxform app. When you click on the Posts, You can perform action add, update, delete, etc on this model.

Leave a Reply