a1 = A.objects.create()
a2 = A.objects.create()
b1 = B.objects.create()
b2 = B.objects.create(ref_a=a2)
print(a1.get_b)
print(a2.get_b)
print(b1.a)
print(b2.a)
Check if a OneToOne relation exists in Django