title: Django 'QuerySet' object has no attribute 'split' using modelform
body: <p>I'm having a problem getting my view to update a manytomany field. It returns this after the form is submitted.</p>
  
  <pre><code>Traceback:
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
    111.                         response = callback(request, *callback_args, **callback_kwargs)
  File "/home/footbook/Ubuntu One/webapps/fb/poc/../poc/activity/views.py" in activity_save_page
    44.             group_names = form.cleaned_data['groups'].split()
  
  Exception Type: AttributeError at /activity_save/
  Exception Value: 'QuerySet' object has no attribute 'split'
  </code></pre>
  
  <p>Here are the files.
  Models.py</p>
  
  <pre><code>class Group (models.Model):
      group_nm = models.CharField(max_length=64)
      group_desc = models.CharField(max_length=250)
      created = models.DateTimeField(auto_now_add=True)
      active_yn = models.BooleanField(default=True)
      def __unicode__(self):
          return self.group_nm
  
  
  
  class Activity(models.Model):
      activity_nm = models.CharField(max_length=60)  
      activity_desc = models.CharField(max_length=250)
      startdt = models.DateField()
      enddt = models.DateField()
      crdt = models.DateTimeField(auto_now_add=True,editable=False)
      groups =  models.ManyToManyField(Group)
      upddt = models.DateTimeField(editable=False)
      def  save(self, *args, **kwargs):
          if not self.id:
              self.crdt = datetime.date.today()
          self.upddt = datetime.datetime.today()
          super(Activity, self).save(*args, **kwargs)
      def __unicode__(self):
          return self.name     
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>def make_custom_datefield(f):
      formfield = f.formfield()
      if isinstance(f, models.DateField):
          formfield.widget.format = '%m/%d/%Y'
          formfield.widget.attrs.update({'class':'datePicker', 'readonly':'true'})
      return formfield
  
  
  class ActivitySaveForm(forms.ModelForm):
      formfield_callback = make_custom_datefield
      def __init__(self, *args, **kwargs):
          super(ActivitySaveForm, self).__init__(*args, **kwargs)
          self.fields['activity_nm'].label = "Activity Name"
          self.fields['activity_desc'].label = "Describe It"
          self.fields['startdt'].label = "Start Date"
          self.fields['enddt'].label = "End Date"
          self.fields['groups'].label ="Group"
      class Meta:
          model = Activity
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def activity_save_page(request):
      if request.method == 'POST':
          form = ActivitySaveForm(request.POST)
          if form.is_valid():
              act, created = Activity.objects.get_or_create(
                  activity_nm = form.cleaned_data['activity_nm']
              )
              act.activity_desc = form.cleaned_data['activity_desc']
              if not created:
                  act.group_set.clear()
              group_names = form.cleaned_data['groups'].split()
              for group_name in group_names:
                  group, dummy = Group.objects.get_or_create(group_nm=group_name)
                  act.group_set.add(group)
              act.save()
              return HttpResponseRedirect('/activity/')
      else:
          form = ActivitySaveForm()
      variables = RequestContext(request, {
          'form': form
      })
      return render_to_response('activity_save.html', variables)
  </code></pre>
  
  <p>I think it would work if I wasn't using the modelform, but I need it to implement <a href="https://stackoverflow.com/questions/660929/how-do-you-change-the-default-widget-for-all-django-date-fields-in-a-modelform" title="SO answer to datepicker question.">this datepicker.</a> Since it's a manytomany field, I want to split them when they are entered into the database, but my queryset fails. I've tried changing this a bunch of different ways, but I'm stuck. I've seen a lot of similar questions, but they either had foreign keys or no modelform. </p>
  
  <p>Thanks.</p>
  
  <p>EDIT:
  activity_save.html</p>
  
  <pre><code>{% extends "base.html" %}
  {% block title %}Save Activity{% endblock %}
  {% block head %}Save Activty{% endblock %}
  &lt;input class="datePicker" readonly="true" type="text" id="id_startdt" /&gt;
  &lt;input class="datePicker" readonly="true" type="text" id="id_enddt" /&gt;
  {% block content %}
  
  
  &lt;form action="{% url activity.views.activity_save_page act_id%}" method="post"&gt;{% csrf_token %}
  
  {{ form.as_p }} 
  
  &lt;input type="submit" value="save it" /&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>