Django Admin
Django Admin
Lets see how Django admin and how to work:
Enabling and customizing the Django admin interface:
The Django admin is a built-in feature that provides a user-friendly interface for managing your site's data.
To enable the admin interface for your Django project, follow these steps:
Ensure that your app is included in the INSTALLED_APPS list in the settings.py file of your Django project.
Run python manage.py createsuperuser to create a superuser account that can access the admin interface.
Register your models with the admin interface by defining an admin class for each model in the admin.py file of your app.
For example, to enable the admin interface for the Post model we defined earlier:
from django.contrib import admin
from .models import Post
admin.site.register(Post)
Managing models and data using the admin interface:
This is an interface that is an admin option in the admin where you will register your models using your superuser (super User) account you have created.
From the admin interface, you can perform various tasks, including:
Viewing and editing data: The box list will display all the instances powered by a model, you can edit existing instances as well as create a new instance.
Searching and filtering: You are allowed to look for particular models of a kind and screen the list of instances of various models due to some criteria.
Managing users and permissions: As a superuser, you're also able to oversee the inviduals and whatever their permissions are in the admin interface.