title: How can I add parent fields to a Django InlineFormSet?
body: <p>How can I add a <em>parent</em> field to an <a href="https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets" rel="noreferrer">InlineFormSet</a>?  </p>
  
  <h2>My attempt:</h2>
  
  <p>models.py:</p>
  
  <pre><code>from django.db import models
  
  class Parent(models.Model):
      parent_name = models.CharField(max_length=45)
  
  class Child(models.Model):
      child_name = models.CharField(max_length=45)
      parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
  </code></pre>
  
  <p>forms.py:</p>
  
  <pre><code>from .models import Parent, Child
  from django import forms
  
  FormSet = forms.inlineformset_factory(Parent, Child, 
            fields='__all__'
  )
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from .models import Parent
  from .forms import FormSet
  
  def view(req):
      instance = Parent.objects.get(pk=1)
      form = FormSet(instance=instance)
  </code></pre>
  
  <p>This results in all of the fields from <code>Child</code> being displayed, but none from <code>Parent</code>.</p>