Convert an isinstance() back to a type()

This reverts one line of 673e5dd.  Previously it was checking if the type() of
something was QuerySet (and erroring if so).  The change caused it to error on
*any* instance of QuerySet, including for example a ValuesListQuerySet.
Merge branch 'fix-isinstance' into mit-prod