Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Admin Interface | Models, datatypes, and fields
Django ORM Ninja: Advanced Techniques for Developers
course content

Course Content

Django ORM Ninja: Advanced Techniques for Developers

Django ORM Ninja: Advanced Techniques for Developers

1. Introduction to Django ORM
2. Models, datatypes, and fields
3. Queries
4. Relations
5. Complex Queries
6. Advanced

book
Admin Interface

Django allows you to manage content using the Admin page. Now we will set up the admin panel to see our database through the Django server.

Go to urls.py. We can see that the standard endpoint of the admin page is already indicated, and let's learn how to run our project.

For this, we write the command:

Clicking on the link http://127.0.0.1:8000/ takes us to the base of our Django project. Now, if we navigate to the http://127.0.0.1:8000/admin/ endpoint, we'll arrive at the default admin panel interface.

However, we're unable to access it at the moment since our database currently has no users. To resolve this, we need to go back to our project and use the console to execute a command that will assist in creating an admin user.

Enter a username, email, and a secure password, but remember it.

Let's return to our admin panel and enter our username and password. Now we are inside the standard admin panel. We don't have anything here yet, no models. For this, we need to register models in the admin.

In our project, we open the admin.py file. First, let's try the standard registration, for example:

Go back to the page and see that our first model has appeared. We can create our first instance by clicking the +Add button. For example, biography. Now, we have the first object in our database.

Return to our admin.py file.

Let's register all our models Author and Book.

For now, we will not delve into all the details of registration in the admin panel. Standard settings will suffice for us to check the status of our database.

arrowfolder
__init__.py

__init__.py

folder/
folder

bookstore

folder

.idea

folder

inspectionProfiles

profiles_settings.xml

profiles_settings.xml

.gitignore

.gitignore

bookstore_orm.iml

bookstore_orm.iml

misc.xml

misc.xml

modules.xml

modules.xml

workspace.xml

workspace.xml

folder

app

__init__.py

__init__.py

asgi.py

asgi.py

settings.py

settings.py

urls.py

urls.py

wsgi.py

wsgi.py

folder

db

folder

migrations

__init__.py

__init__.py

__init__.py

__init__.py

admin.py

admin.py

apps.py

apps.py

models.py

models.py

tests.py

tests.py

views.py

views.py

data.json

data.json

manage.py

manage.py

requirements.txt

requirements.txt

copy
1. What is the primary purpose of the Django Admin page?
2. How do you start the Django development server?
3. What command is used to create an admin user in Django?
4. To register a model in the Django admin panel, what should you do?
5. After registering a model like 'Genre' in 'admin.py', what can you do in the admin panel?
What is the primary purpose of the Django Admin page?

What is the primary purpose of the Django Admin page?

Select the correct answer

How do you start the Django development server?

How do you start the Django development server?

Select the correct answer

What command is used to create an admin user in Django?

What command is used to create an admin user in Django?

Select the correct answer

To register a model in the Django admin panel, what should you do?

To register a model in the Django admin panel, what should you do?

Select the correct answer

After registering a model like 'Genre' in 'admin.py', what can you do in the admin panel?

After registering a model like 'Genre' in 'admin.py', what can you do in the admin panel?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 5
We're sorry to hear that something went wrong. What happened?
some-alt