One-to-One Relationships
One-to-One Relationships
One-to-one relationships are often used when two models share a unique relationship. For example, let’s say we have a Profile model associated with a User model. Each user should have exactly one profile, and each profile belongs to a single user. In Django, you can define a one-to-one relationship using the OneToOneField:
Last updated