[Answer]-Can you use __in to filter through foreign keys?

1👍

The question is are you doing:

Child.objects.filter(parent__in=Parent.objects.filter(...))

or

Child.objects.filter(parent_id__in=Parent.objects.filter(...))

The first version will work, the second version will give you the “invalid literal for int() with base 10” error.

Leave a comment