Hello djangonauts, I wrote my first manipulator and there is still some part that I am not understanding. I have the feeling that I am missing something obvious in the save function of my manipulator but I am unable to improve it.
I would be glad if someone could explain me how to set_localisation to my "Profile" ? I am a bit lost there. Thank you for your help ======================= Here it is the error message I am getting: ========================= TypeError at /profiles/create_manip/ list objects are unhashable Request Method: POST Request URL: http://localhost:8000/profiles/create_manip/ Exception Type: TypeError Exception Value: list objects are unhashable Exception Location: c:\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\meta\__init__.py in method_set_many_to_many, line 1138 ===================== Here it is my manipulator ===================== class announceManagerProfileManipulator(formfields.Manipulator): def __init__(self, pk=None): self.fields = ( #formfields.SelectField(field_name='user', is_required=True, choices=[('','-------')] + [(o.id, o) for o in users.get_list()]), formfields.TextField(field_name='pseudo', is_required=True, maxlength=30), #formfields.RadioSelectField(field_name='gender', radio_admin=True, choices=[('','-------')] + [(o.id, o) for o in genders.get_list()]), formfields.RadioSelectField(field_name='gender', choices=[(o.id, o) for o in genders.get_list()]), formfields.TextField(field_name='address', maxlength=300), formfields.TextField(field_name='phonenumber', maxlength=10), formfields.CheckboxField(field_name='want_to_publised_personal_info'), #formfields.SelectField(field_name='memberShipLevel', is_required=True, radio_admin=True, choices=[('','-------')] + [(o.id, o) for o in membershiplevels.get_list()]), formfields.RadioSelectField(field_name='memberShipLevel', is_required=True, choices=[(o.id, o) for o in memberships.get_list()]), formfields.SelectMultipleField(field_name='localisation', choices=[(o.id, o) for o in localisations.get_list()], size=5, ), ) def save(self, new_data, current_user): temp = Profile( user=current_user, pseudo=new_data['pseudo'], #want_to_publised_personal_info=new_data['want_to_publised_personal_info'], memberShipLevel=memberships.get_object(pk=new_data['memberShipLevel']), want_to_publised_personal_info=False, ) if new_data['localisation']: temp.set_localisation([list(new_data['localisation'])]) ### <=== This is where my problem is locating if new_data['gender']: temp.gender= genders.get_object(id__exact=new_data['gender']) temp.address = new_data['address'] temp.phonenumber = new_data['phonenumber'] if new_data['want_to_publised_personal_info']: temp.want_to_publised_personal_info= new_data['want_to_publised_personal_info'] temp.is_default_profile=True temp.save() return temp --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---