Reduce query counts when querying API resources.

We previously introduced a prefetch_related() optimization for list
resources, helping to get the query counts down for any referenced
ManyToManyFields.

We also had a select_related() call, but this wasn't good enough.
Calling select_related() without parameters will only operate on
ForeignKeys that don't allow for NULL values.

Now, we build a list of fields to explicitly pass to select_related().
This has the benefit of working with fields that allow NULL values, and
prevents looking up fields we're not going to return in the payload.

Reviewed at https://reviews.reviewboard.org/r/6411/