[Answer]-Django ManyToManyField Retrieving both objects error

1👍

Because board = Board.objects.filter(user=users) is filtering by user it expects one user to be provided. If you were to do something like board = Board.objects.filter(user__in=users) which uses the __in filter, the filtering will correctly use the list of user objects.

You could also use a flat list of id’s instead of objects like so board = Board.objects.filter(user__in=sarah.following.all().values_list('user__pk',flat=T‌​rue))

Leave a comment