Hi, I am fairly new to django, so if I missed a piece of documentation that would describe what I want to do please feel free to redirect me, I may have missed it in my search.
I have a pretty simple problem that I cannot quite get my head around. I have a Many To Many relationship between UserProfile and Group (a custom group class, not the django auth one) that represents which real life groups my users are members of. The users should be able to join some of the groups all by themselves, while for others an admin must do the group join operation for them. I am currently having a problem with the view that allows the users to join groups. It uses a ModelForm with a custom filter on the groups the user can select, like so: class UserProfileForm(ModelForm): groups = forms.ModelMultipleChoiceField(queryset=Group.objects.filter (open_to_all__exact='True'), required=False) class Meta: model = UserProfile exclude = ('member_id', 'member_status', 'year_of_entry', 'course_at_entry', 'user') The problem is that when I save this form, the group memberships of the items that were excluded by the filter get deleted. How can I avoid this? My attempt was to do this before the form.save() call: form.cleaned_data['groups'] = form.cleaned_data['groups'] + list (fixed_memberships) but cleaned_data['groups'] seems to be a queryset and I have not yet understood how to modify this queryset to include items from another queryset or a list. Any hints would be greatly appreciated! TIA, Daniel --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---