[Answered ]-Filter data from models based on some condition

2👍

To select the clients that aren’t present in clientData, we can get a list of clients across the clientData records and then run an exclude to filter them out.

included_clients = clientData.objects.values_list('client', flat=True)

excluded_clients = Client.objects.exclude(id__in=included_clients)

Leave a comment