Fixed #14334 -- Query comparision now check for object types.

Also, I think we need to allow querying using parent type. That is if we have f = ForeignKey(Restaurant) where Restaurant is subclass of Place, then querying using f__in=[place1, place2] should work. While it is arguable if this is a good API, this works currently, and forbidding it will make currently working user code break.