from django.db.models import Case, When, IntegerField
Thing.objects.annotate(tag_is_known=Case(When(tags__name__in=['foo', 'bar'],
    then=1), default=0, output_field=IntegerField()))
Заказать набор запросов django с помощью ManyToManyField = Value