[Answer]-How to iterate over a m2m field with __contains

1👍

__contains is used for case-sensitive containment search (https://docs.djangoproject.com/en/dev/ref/models/querysets/#contains), you just need plain id equality match:

raid_teams = Team.objects.filter(
    Q(tanks__id=profile.pk) |
    Q(healers__id=profile.pk) | 
    Q(dps__id=profile.pk)
)

Leave a comment