Reputation: 7831
I have the following code to put all my users from a multichoice field into a list
USERS = []
for user in User.objects.filter(groups__name='accountexec'):
USERS.append((user.id,user))
I need to use Log.objects.filter() to get all the logs with a user= to a user in the USERS list
Upvotes: 15
Views: 18782
Reputation: 599490
Use the __in
lookup:
Log.objects.filter(user__in=User.objects.filter(groups__name='accountexec'))
Upvotes: 48