Fix custom view not returning subclassed model objects correctly

Please see the test case for what this does. I can also explain this in some more detail (why and where we're using it) if you want.