Extract the query view and convert it to CBV.

I was recreating a half arsed version of CBVs inside the resources which had
the potential to become quite a mess but it also could have leaked data between
requests as the resource object was instantiated at load time and I used it to
save the request object in 'self.request'. This has now been fixed for the
query view which is now a proper CBV.