Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
One-to-One | Relations
Django ORM Ninja: Técnicas Avanzadas para Desarrolladores
course content

Contenido del Curso

Django ORM Ninja: Técnicas Avanzadas para Desarrolladores

Django ORM Ninja: Técnicas Avanzadas para Desarrolladores

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

bookOne-to-One

A One-to-One relationship is used when one object of a model corresponds to exactly one object of another model. For example, a table of employees and another table of employee ID badges, where each employee has exactly one unique ID badge. To specify a One-to-One relation, use models.OneToOneField.

OneToOneField accepts all of the extra arguments accepted by ForeignKey.

There is just example of usage One-to-One relations. We will not use it in our project.

You can learn more about this relation in the official documentation.

How can you access the related Badge object from an Employee instance named employee?

How can you access the related Badge object from an Employee instance named employee?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 3
some-alt