title: How would I make Django form fields have children?
body: <p>I am trying to display a form with a bunch of fields. I am trying to group the fields together so there is a parent field and then some child fields underneath the parent field.</p>
  
  <p>So what I have done is in my form created a dictionary with the parent fields as keys that access a list of the child fields.</p>
  
  <p>Here is my form:</p>
  
  <pre><code>class DetailForm(Form):
      a = BooleanField(label='a')
      a1 = BooleanField(label='a1')
  
      b = BooleanField(label='b')
      b1 = BooleanField(label='b1')
      b2 = BooleanField(label='b2')
  
      c = BooleanField(label='c')
      c1 = BooleanField(label='c1')    
      c2 = BooleanField(label='c2')
      c3 = ChoiceField(choices=((1,'Default Text'),(0,'Custom Text'),), widget=RadioSelect, label='c3')
  
      fields_dict = {a: [a1],
                     b: [b1, b2],
                     c: [c1, c2, c3]
                    }
  </code></pre>
  
  <p>Here is my view:</p>
  
  <pre><code>def bfa_report(request, template):
      form = DetailForm()
      fields_dict = form.fields_dict
      return render_to_response(template, {
          'form': form,
          'fields_dict': fields_dict
          }, context_instance=RequestContext(request))
  </code></pre>
  
  <p>Here is what I'm doing in my template:</p>
  
  <pre><code>&lt;div data-dojo-type="dijit/form/Form" id="parameters_form" data-dojo-id="parameters_form" encType="multipart/form-data" action="" method=""&gt;
      {% csrf_token %}
      {%  for key, value in fields_dict.items %}
          &lt;div&gt;{{ key }}&lt;/div&gt;
          &lt;div&gt;
              {% for val in value %}
                  &lt;div&gt;
                      {{ val }}
                  &lt;/div&gt;
              {% endfor %}
          &lt;/div&gt;
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>When I go to the page, I end up with this displayed on the page:</p>
  
  <pre><code>a
  &lt;django.forms.fields.BooleanField object at 0x7f3aa4444cd0&gt;
  b
  &lt;django.forms.fields.BooleanField object at 0x7f3aa4442490&gt;
  &lt;django.forms.fields.BooleanField object at 0x7f3aa4442d90&gt;
  c
  &lt;django.forms.fields.BooleanField object at 0x7f3aa4442e10&gt;
  &lt;django.forms.fields.BooleanField object at 0x7f3aa4442e90&gt;
  &lt;django.forms.fields.ChoiceField object at 0x7f3aa4442f10&gt;
  </code></pre>
  
  <p>The fields aren't showing up. I'm sure there is a better way to do what I'm trying to do. How do I get the fields grouped the way I them to?</p>
  
  <p>I'm trying to create a generic template to do this. I have several forms that I need displayed, and I don't want to create a separate template for each form.</p>