On Tue, Feb 16, 2010 at 10:01 AM, Tom <t.scr...@gmail.com> wrote:
> I can set other initial data, for example to the 'notes' CharField
> fine.  I guess my question boils down to: how do you set initial data
> for a many-to-many field?

The initial data for a many to many field needs to be a list. So::

    f = EmailForm(initial={'contacts': [contact.id]})

Remember: it's a *many-to-many* field, which means that the field has
*many* values.

Also notice the error message: "'long' object is not iterable". This
is telling you that someone, somewhere, has tried to iterate (treat as
a list) something (a long integer) that isn't a list object.

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to