title: Django: Same form multiple times in one view
body: <p>I have the three models <code>User</code> (django.contrib.auth), <code>Screening</code> and <code>User_Screening</code>. The <code>User_Screening</code> is a m2m table with the extra field <code>status</code>.</p>
  
  <pre><code>#models.py
  from django.db import models
  from django.contrib.auth.models import User
  
  class Screening(models.Model):
      title = models.CharField(max_length=255)
      start = models.DateTimeField()
      user_relation = models.ManyToManyField(User, blank=True,
          through='User_Status')
  
  class User_Status(models.Model):
      ATTENDING = 'c'
      NOT_ATTENDING = 'n'
      PROJECTION = 'p'
      STATUS_CHOICES = (
          (ATTENDING, 'attending'),
          (NOT_ATTENDING, 'not attending'),
          (PROJECTING, 'projecting'),
      )
      screening = models.ForeignKey(Screening)
      user = models.ForeignKey(User)
      status = models.CharField(max_length=1, choices=STATUS_CHOICES)
  </code></pre>
  
  <p>Now I want to make a view, which shows all upcoming screenings. So far, so easy:</p>
  
  <pre><code>#views.py
  @login_required()
  def index(request):
      current_screenings = Screening.objects.filter(start__gte=timezone.now())
      context = {'current_screenings': current_screenings}
      return render(request, 'schedule/index.html', context)
  </code></pre>
  
  <p>In this view, logged in users should be able, to update their <code>status</code> (from the <code>User_Screening</code> table). It could also be, that the user does not yet have a record for this screening, so one should be created.</p>
  
  <p>I don't understand, how I could archive a form dropdown field for each screening, where the user can select his status. (Either <code>?</code> if no status is set yet, <code>attending</code>, <code>not attending</code> or <code>projection</code>)</p>
  
  <p>From what I understand I need multiple forms, that are aware what screening they are related to.</p>
  
  <p>Also, <a href="https://docs.djangoproject.com/en/1.6/topics/forms/formsets/" rel="nofollow">Formsets</a> seem not to work, because I can't always fill a form with initial data, as there could be records missing for some or all screenings. Furthermore I would not know, which form belongs to which of the screening objects.</p>
  
  <p><strong>Update:</strong>
  What I want to end up with in HTML is something like this:</p>
  
  <pre><code>&lt;form&gt;
    &lt;h1&gt;Current Screening 1&lt;/h1&gt;
      &lt;select onchange="submit()" name="screening_user" id="s1"&gt;
        &lt;option value="att"&gt;Attending&lt;/option&gt;
        &lt;option value="not_att"&gt;Not Attending&lt;/option&gt;
        &lt;option selected="selected" value="pro"&gt;Projection&lt;/option&gt;
      &lt;/select&gt;
    &lt;h1&gt;Current Screening 2&lt;/h1&gt;
      &lt;select onchange="submit()" name="screening_user" id="s2"&gt;
        &lt;!-- The 'Please Select' option is only visible, if the user does not
          have a relation in 'User_Screening' for this screening --&gt;
        &lt;option selected="selected" value="none"&gt;Please Select&lt;/option&gt;
        &lt;option value="att"&gt;Attending&lt;/option&gt;
        &lt;option value="not_att"&gt;Not Attending&lt;/option&gt;
        &lt;option value="pro"&gt;Projection&lt;/option&gt;
      &lt;/select&gt;
    &lt;!-- More Screenings --&gt;
    &lt;h1&gt;Current Screening n&lt;/h1&gt;
      &lt;!-- select for screening n --&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Therefore a changing amount of forms is needed, from the same form with preloaded data according to the logged in user. </p>