On Apr 17, 1:23 pm, Bastien <[email protected]> wrote:
> Hi,
>
> I'm trying to retrieve a list of users belonging  to a given group but
> don't understand how to do it. It must be a sort of many to many query
> but I can't get it to work.
>
> I would like to do something like this:
>
> basic_users_list = User.objects.filter(groups__in=Group.objects.get
> (name='basic'))
>
> but django tells me that:
>
> 'Group' object is not iterable
>
> If there is another way to do some actions on a given group then I
> would be as happy.
>
> thanks for your guidance.

Does this not work?
basic_users_list = User.objects.filter(
    groups=Group.objects.get(name='basic'))

--
DR.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to