Hello Gabriel, Instead of courses = new_data['courses'] use courses = new_data.getlist('courses') The "courses" is not a string, but a class similar to a list type (I don't remember the name of that class). The last item of that list is the representation of that class. Therefore, you see 2 if something till 2 is selected and you see 3 if something until 3 is selected. And "getlist" is the method to get a list of all its items (i.e.: [1,3]).
I hope this will help you to solve your problem. To make it clear what is what, play around with Python IDE: python manage.py shell Good luck! Aidas Bendoraitis [aka Archatas] On 9/21/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote: > Hey, I'm trying to write a manytomany into the database. I have created > the form correctly, using {{ form.courses }}, and I can upload > everything. The problem comes when writing the data to the database. I > take the field as following: > courses = new_data['courses'] > And then to write it, I do the following: > new_profile = UserProfile(user=new_user, > courses=courses, > permissions=permissions) > > Problem is, I get "'courses' is an invalid keyword argument for this > function". > > If I try to print courses, I get a number. 1 if I choose the first > option, 2 if I choose option 2 and 1 or just 2, and 3 if I choose three > in any way, with others or alone. > > What exactly do I need to do with this to write it into the database? > > > -- > No violence, gentlemen -- no violence, I beg of you! Consider the > furniture! > -- Sherlock Holmes > > Gabriel Puliatti > [EMAIL PROTECTED] > predius.org > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---