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: 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

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 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.

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?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
some-alt