Conteúdo do Curso
Django ORM Ninja: Advanced Techniques for Developers
Django ORM Ninja: Advanced Techniques for Developers
One-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 an 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.
Obrigado pelo seu feedback!