What's scary about this? It's basically the Django-generated SQL for an M2M field through table, with a few tweaks.