Complete the code to define a one-to-one relationship in Django models.
class Profile(models.Model): user = models.[1](User, on_delete=models.CASCADE)
The OneToOneField creates a one-to-one relationship between models, meaning each Profile is linked to exactly one User.
Complete the code to specify the behavior when the related user is deleted.
user = models.OneToOneField(User, on_delete=models.[1])CASCADE means if the related User is deleted, the Profile will be deleted too, keeping data consistent.
Fix the error in the model field to ensure the one-to-one link is unique.
user = models.OneToOneField(User, on_delete=models.CASCADE, [1]=True)
The OneToOneField is unique by default, but explicitly setting unique=True ensures uniqueness.
Fill both blanks to define a one-to-one field with a custom related name and allow null values.
user = models.OneToOneField(User, on_delete=models.CASCADE, [1]=True, [2]='profile')
null=True allows the field to be empty in the database. related_name='profile' lets you access the profile from the user with user.profile.
Fill all three blanks to create a one-to-one field with cascade delete, a custom related name, and allow blank values in forms.
user = models.OneToOneField(User, on_delete=models.[1], related_name='[2]', [3]=True)
on_delete=CASCADE deletes the profile if the user is deleted. related_name='profile' allows reverse access. blank=True lets forms accept empty input for this field.