title: Create form set of arbitrary form types in Django forms
body: <p>I know given a form type, I can create a form set allowing me to create a set of forms based on the given form type. However, this doesn't quite solve my problem.</p>
  
  <p>Let's say I have a portal for a fast food place where the user can add items and after they choose the item, we spawn forms for extra fields. For instance, if they add a item and choose food type "Drinks", then we give them options to add ice or get it go. If they choose hot food, we ask if they like it spicy. I'm struggling to accomplish this with Django forms. If I had a super form that included all the options regardless of item type, I could accomplish this by creating a FormSet but that's not what we're doing.</p>
  
  <p>I could accomplish creating new forms and dynamically updating every item as user changes the item type using the following code:</p>
  
  <p>In the HTML template, I add the following to create templates.</p>
  
  <pre><code>{% for food_order_form in food_order_form_set %}
      &lt;script id="food-order-template-{{ food_order_form.name }}" type="text/x-custom-template"&gt;
          {{ food_order_form.form.as_p }}
      &lt;/script&gt;
  {% endfor %}
  </code></pre>
  
  <p>Then I have JavaScript code that creates these forms based on a global variable:</p>
  
  <pre><code>var all_items = [{'name': 'food'}, {'name': 'drink'}];
  $(document).ready(function() {
          all_tasks.forEach(function (item, index) {
              $("#items-container").append(
                  '&lt;form id="food-order-inline-form-' + index + '"&gt;' +
                      $('#food-order-template-' + item.name).html() +
                  '&lt;/form&gt;'
              );
          });
      });
  </code></pre>
  
  <p>I can dictate what forms should be created by changing <code>all_items</code> and calling a function to render the forms again, however, I wouldn't be able to show validation errors easily. I can hack something together to accomplish this but it just seems too much hacking for something like this. Is there a better and/or cleaner way to do this with Django?</p>