fix many perf issues

* templates that made duplicate calls
* better use of select_related and prefetch_related
* fixed bug in ModelFilter where it made duplicate queries
* added a bunch of indexes to tables