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: Técnicas Avanzadas para Desarrolladores
course content

Contenido del Curso

Django ORM Ninja: Técnicas Avanzadas para Desarrolladores

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

1. ¿Cuál es el propósito principal de la página de administración de Django?
2. What command is used to create an admin user in Django?
3. To register a model in the Django admin panel, what should you do?
4. After registering a model like 'Genre' in 'admin.py', what can you do in the admin panel?
5. Para registrar un modelo en el panel de administración de Django, ¿qué debes hacer?

¿Cuál es el propósito principal de la página de administración de Django?

Selecciona la respuesta correcta

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

Selecciona la respuesta correcta

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

Selecciona la respuesta correcta

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

Selecciona la respuesta correcta

Para registrar un modelo en el panel de administración de Django, ¿qué debes hacer?

Selecciona la respuesta correcta

¿Todo estuvo claro?

Sección 2. Capítulo 5
We're sorry to hear that something went wrong. What happened?
some-alt