Table relationships in Relational Database design 1. One to One relationship (1-1) A relation is said to be 1-1 if a row in Table A can have only one matching row in Table B Let's take an example of simple 1-1 relationship between user and user_det...

Markdown supported · ⌘↵ to post
islam kamel
Backend Developer
from django.db import models class Address(models.Model): ..... ..... ..... class User(models.Model): ..... ..... ..... address = models.OneToOneField(Address, on_delete=models.CASCADE)I think you need to change that line
addressTo be ForeignKey instead of OneToOne