Fix select_related for documents