title: Django: following the reverse direction of the one-to-one relationship
body: <p>I have a question about the way Django models the one-to-one-relationship. </p>
  
  <p>Suppose we have 2 models: A and B: </p>
  
  <pre><code>class B(models.Model):
        bAtt = models.CharField()
  
  class A(models.Model):
        b = models.OneToOneField(B)
  </code></pre>
  
  <p>In the created table A, there is a field "b_id" but in the table B created by Django there is no such field as "a_id". </p>
  
  <p>So, given an A object, it's certainly fast to retrieve the corresponding B object, simply through the column "b_id" of the A's row. </p>
  
  <p>But how does Django retrieve the A object given the B object? </p>
  
  <p>The worst case is to scan through the A table to search for the B.id in the column "b_id". If so, is it advisable that we manually introduce an extra field "a_id" in the B model and table? </p>
  
  <p>Thanks in advance!</p>