Take object views into account in MULTIDB_PINNING_VIEWS

The middleware for MULTIDB_PINNING_VIEWS was assuming that the view
function has a __name__. This is true in function and class-based views;
but there are also views that are objects, such as
django.contrib.syndication.views.Feed. The middleware was raising an
exception when attempting to process such views. This is now fixed.