2👍
✅
The problem is this line
enrolments = Enrolment.objects.filter(intervention=intervention, household__name__in=households):
households is a queryset of Household
instances, not names. I think that either of the following would work.
enrolments = Enrolment.objects.filter(intervention=intervention, household__in=hh_name)
enrolments = Enrolment.objects.filter(intervention=intervention, household__name__in=hh_name)
If you use the second one, then it looks like you can remove the households
queryset from your code.
Source:stackexchange.com