4👍
✅
You can use the primary keys in the queryset to filter with pk__in=…
:
Task.objects.filter(
pk__in=Task.objects.filter(type='Active').order_by('-id').values('pk')[:10]
).delete()
Source:stackexchange.com