Fixed #23616 - Fixed generic relations in ModelAdmin.list_filter.

Thanks ranjur for reporting bug, timgraham for review,
and collinanderson for contributing tips.