title: Django Initial for a ManyToMany Field
body: <p>I have a form that edits an instance of my model. I would like to use the form to pass all the values as hidden with an inital values of <code>username</code> defaulting to the logged in user so that it becomes a <code>subscribe</code> form. The problem is that the normal <code>initial={'field':value}</code> doesn't seem to work for manytomany fields. how do i go about it? </p>
  
  <p>my views.py</p>
  
  <pre><code>@login_required
  def event_view(request,eventID):
      user = UserProfile.objects.get(pk=request.session['_auth_user_id'])
      event = events.objects.get(eventID = eventID)
      if request.method == 'POST':
          form = eventsSusbcribeForm( request.POST,instance=event)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect('/events/')
  
      else:
          form = eventsSusbcribeForm(instance=event)
  
      return render_to_response('event_view.html', {'user':user,'event':event, 'form':form},context_instance = RequestContext( request ))
  </code></pre>
  
  <p>my forms.py</p>
  
  <pre><code>class eventsSusbcribeForm(forms.ModelForm):
      eventposter = forms.ModelChoiceField(queryset=UserProfile.objects.all(), widget=forms.HiddenInput())
      details = forms.CharField(widget=forms.Textarea(attrs={'cols':'50', 'rows':'5'}),label='Enter Event Description here')
      date = forms.DateField(widget=SelectDateWidget())
  
  
      class Meta:
          model = events
          exclude = ('deleted')
  
      def __init__(self, *args, **kwargs):
          super(eventsSusbcribeForm, self).__init__(*args, **kwargs)
          self.fields['username'].initial = (user.id for user in UserProfile.objects.filter())
  </code></pre>
  
  <p>my models.py </p>
  
  <pre><code>class events(models.Model):
      eventName  = models.CharField(max_length=100)
      eventID =  models.AutoField(primary_key=True)
      details = models.TextField()
      attendanceFee = models.FloatField(max_length=99)
      date = models.DateField()
      username = models.ManyToManyField(UserProfile, related_name='user', blank=True)
      eventposter = models.ForeignKey(UserProfile, related_name='event_poster')
      deleted = models.BooleanField()
  
      def __unicode__(self):
          return u'%s' % (self.eventName)
  </code></pre>