[#725, #630] Fix breaking of partner sites

Work around the SQL query that hangs by assembling the list of countries
in python instead.

Use prefetch_related() to (hopefully) minimize the number of queries
needed.
[#630] Add piwik tracking code to parter sites widgets