Thanks

On Thu, Jan 2, 2020 at 9:35 PM Lunga Baliwe <lunga...@gmail.com> wrote:

> Hi there,
> maybe you can use  something like
> User.objects.filter(groups__name__in=['test1', 'test2']).
> Also check https://docs.djangoproject.com/en/3.0/ref/models/querysets/#in for
> examples of using __in
>
> On Thu, Jan 2, 2020 at 6:49 AM sum abiut <suab...@gmail.com> wrote:
>
>> Hi,
>> I have two separate groups, for example, test1, and test2. I want to get
>> a user that is a member of group test1 and group test2.
>>
>> I've try User.objects.filter(groups__name='test1') to get users of  group
>> test1. not sure how to check if a user belongs to group test1 and is also
>> belong to group test2
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPCf-y6F2rbgG1%3DgK4QX8FDKDq61b8mVdvtrtv5LwQQmfwhY3g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPCf-y6F2rbgG1%3DgK4QX8FDKDq61b8mVdvtrtv5LwQQmfwhY3g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANDnEWeuXRnMqCiS8co%3DhifuUhC8NrYo8e1j8Y_EVF6r1sBwew%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANDnEWeuXRnMqCiS8co%3DhifuUhC8NrYo8e1j8Y_EVF6r1sBwew%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 



*Security Blog : Security Tips <http://mysecuritytips.wordpress.com/>  |
Programming  Blog: Programming <http://mrcoderguide.wordpress.com>*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5S-q2R4W5zmFEuSJ2S5ENr4tcpUuiDWrWrLUPEb%3DWUBg%40mail.gmail.com.

Reply via email to