Django queries: how to filter objects to exclude id which is in a list?
You can also do this using the Q
object:
from django.db.models import Q
MyObject.objects.filter(time__gte=datetime.now()).filter(~Q(id__in=object_id_list))
MyObject.objects.filter(time__gte=datetime.now()).exclude(id__in=object_id_list)