On Thu, 2006-09-21 at 06:42 -0500, Gabriel Puliatti wrote:
> On Thu, 2006-09-21 at 06:30 +0000, pflouret wrote:
> > try this:
> > 
> > new_profile = UserProfile(user=new_user, permissions=permissions)
> > new_profile.save()
> > new_profile.courses = courses
> > new_profile.save()
> 
> Tried that. Failed with "'str' object has no attribute '_get_pk_val'".

If you are assigning to a many-to-many attribute, you need to be
assigning a set or list of objects (the objects being the things pointed
to by the many-to-many field). You are attempting to assign a string.

After you get your courses string from your form, you need to turn them
into the appropriate objects (whether that means retrieving the objects
from the database or creating them from scratch) and then assign that
list of objects to new_profile.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to