[Answer]-Django ORM: All items not in table

1👍

You are filtering all events with user_id=1 and exclude everything which has events with user_id = 1 which results in an empty queryset.

Try this:

qs = SchedulerEvent.objects.filter(user_id=<user_id>).exclude(schedulereventreceipt__event__user_id=<user_id>)

which excludes all the corresponding SchedulerEventReceipt which has the current user as the user_id

Leave a comment