title: Pre-selecting multiple checkboxes in Django forms
body: <p>Very similar to <a href="https://stackoverflow.com/questions/15314357/how-to-make-pre-selected-checkbox-in-django">this question</a>, but I tried the accepted answer and it did not work. Here's what's going on.</p>
  
  <p>I have a form for tagging people in photos that looks like this:</p>
  
  <p><em>forms.py</em></p>
  
  <pre><code>class TaggingForm(forms.Form):
      def __init__(self, *args, **kwargs):
          queryset = kwargs.pop('queryset')
          super(TaggingForm, self).__init__(*args, **kwargs)
          self.fields['people'] = forms.ModelMultipleChoiceField(required=False, queryset=queryset, widget=forms.CheckboxSelectMultiple)
  ...
  </code></pre>
  
  <p><em>models.py</em> </p>
  
  <pre><code>class Photo(models.Model):
      user = models.ForeignKey(User)
  ...
  
  class Person(models.Model):
      user = models.ForeignKey(User)
      photos = models.ManyToManyField(Photo)
  ...
  </code></pre>
  
  <p>I want users to be able to edit the tags on their photos after they initially tag them, so I have a page where they can go to view a single photo and edit its tags. For obvious reasons I want to have the already-tagged individuals' checkboxes pre-selected. I tried to do this by giving the form's initial dictionary a list of people I wanted selected, as in the answer to the question I linked above.</p>
  
  <p><em>views.py</em></p>
  
  <pre><code>def photo_detail(request,photo_id):
  
      photo = Photo.objects.get(id=photo_id)
  
      initial = {'photo_id':photo.id, 'people':[p for p in photo.person_set.all()]}
      form_queryset = Person.objects.filter(user=request.user)
  
      if request.method == "POST":
          form = TaggingForm(request.POST, queryset=form_queryset)
          # do stuff
      else:
          form = TaggingForm(initial=initial, queryset=form_queryset)
  ...
  </code></pre>
  
  <p>When I try to initialize people as in the above code, the form doesn't show up, but no errors are thrown either. If I take the 'people' key/value pair out of the initial dictionary the form shows up fine, but without any people checked. 
  Also I'm using Django 1.5 if that matters. Thanks in advance.</p>