Reduced domain queries.

Reduced the number of queries by using select_related.