search_fields = ['question', 'choice_choice']
Where choice_choice is supposed to be pointing to the choice field in
the choice model, but something is not working with that. I am sure
that I am missing something very easy and I was wondering if someone
could point it out to me.
Thanks,
Craig
Try two underscores:
search_fields = ['question', 'choice__choice']
Craig
This doesn't work correctly because it searches the result of an inner
join of the poll and choice tables. Consequently
- it will not find polls that have no choices, even if the search term
is found in the question field, because the polls will not be in the join.
- polls with multiple choices will be listed multiple times in the
result if the search term is found in the question field, because the
poll appears in the join once for each choice.
Is there a way to get this to work correctly?
Thanks,
Kent