When doing a list_filter on some object in the Django interface, every single item will be displayed. This is not always smart when very long list of choices can be displayed, even though the majority of these choices might not even exist in the database at all.

Using this script will only display a filtering possibility for those items actually present in the database.

This script is not generic, and you will need to change the lines noted "Change this", since I cannot know what exactly you need to filter.

There is possibly a way to make this completely generic, and I hope this will inspire someone to make it!