Create an Admin Site
You can create a Django admin site to edit your application's data from a web interface. To learn more about the Django admin site and its features, see The Django admin site in the Django documentation.
Create an admin user
Before creating an admin site, you must create a user who can log in to the site.
From your project's root directory, run the following command to create an admin user:
python manage.py createsuperuser
Then, your terminal prompts you for a username, email address, and password. For each prompt, enter the following information to create a user with the specified credentials and press "enter" after each entry:
Username: admin Email address: admin@example.com Password: <admin-password> Password (again): <admin-password>
Replace the <admin-password>
placeholder with your user's password.
Enter the admin site
Run the following code to start your server:
python manage.py runserver
Once your server is running, visit the http://127.0.0.1:8000/admin/ URL to see the admin site. This site displays the following login screen:

Enter the username and password created in the previous step to log in to the site.
Access your "sample_mflix" app from the admin site
After logging in to the admin site, you can see the following information:

You can edit your project's authentication configuration by selecting the Groups or Users row in the Authentication and Authorization table.
To edit the data in the users
sample collection, represented by your
Viewer
model, navigate to your project's sample_mflix/admin.py
file
and paste the following code:
from django.contrib import admin from .models import Viewer admin.site.register(Viewer)
Now, your admin site displays the following information:

Select a Viewer object
You can view the data stored in a Viewer
object that
has a name
value of "Abigail Carter"
. You created
this object in the Write Data to MongoDB step
of this tutorial.
Click on the Viewers row of the SAMPLE_MFLIX table to see a list of viewers. The admin site displays the following list:

Then, click on Abigail Carter at the top of the list. The site displays the Name and Email of the selected viewer:

Edit the data in a Viewer object
To edit the email
field of the viewer, select the
box that contains the text "abigail.carter@fakegmail.com"
.
Delete this text and replace it with "acarter1@fakegmail.com"
,
as shown in the following image:

Then, click the SAVE button below the viewer's information to save your changes.
After completing these steps, you can access the Django
admin site and use it to edit your Viewer
objects.