On Mar 28, 2010, at 1:16 AM, Wilberoni wrote:

> 
> ModelMultipleChoiceField in a form takes a queryset to load the
> selectable items.
> 
>     volunteers =
> forms.ModelMultipleChoiceField( queryset=VolunteerProfile.objects.all )
> 
> In save(), I call cleaned_data to get the items that were selected:
> 
>     new_volunteers = self.cleaned_data.get( 'volunteers', '' )
> 

How about this?

        new_volunteer_ids = [x.pk for x in new_volunteers]

> It returns a list of volunteer objects, which is different than a
> queryset.  I need to convert this list of objects to a list of the
> objects' ids.  How do I do that?  If it was a queryset, I could use
> values_list, but it's not.  It's got me stumped.
> 
> Thanks.
> Wilb
> 


-- 
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