1👍
✅
Even if you use only
it will return the objects of Category
model. So if you use it in in filtering the category objects will be used for filtering and for SQL the ids of those category objects.
If you need to filter on the myfield
values on all the category objects, then use values
instead:
....exclude(myfield__in=Category.objects.values('myfield'))
👤AKS
Source:stackexchange.com