title: How to initialize an empty object with ForeignKey in Django?
body: <p>My models.py looks like that :</p>
  
  <pre><code>class B(models.Model):
      ...
  
  class C(models.Model):
      ...
  
  class D(models.Model):
      ...
  
  class A(models.Model):
      b = models.ForeignKey(B, blank=True, null=True)
      c = models.ForeignKey(C, blank=True,null=True)
      d = models.ForeignKey(D, blank=True,null=True)
  </code></pre>
  
  <p>In views.py, I have to initialize an empty A, and fill it later. I can use </p>
  
  <pre><code>i = A().save()
  </code></pre>
  
  <p>But when I try something like :</p>
  
  <pre><code>i.b.add(objectb)
  </code></pre>
  
  <p>This exception occurs :</p>
  
  <pre><code>'NoneType' object has no attribute 'b'
  </code></pre>
  
  <p>I tried to cancel the null=True :</p>
  
  <pre><code>class A(models.Model):
      b = models.ForeignKey(B, blank=True)
      c = models.ForeignKey(C, blank=True)
      d = models.ForeignKey(D, blank=True)
  </code></pre>
  
  <p>But then another exception occured :</p>
  
  <pre><code>A.b_id may not be NULL
  </code></pre>
  
  <p>I can't figure out how to initialize an empty but not "None" A.</p>
  
  <p>I need your help,</p>
  
  <p>Thanks you</p>