Fixed #23370 -- defer() + select_related() crashed with inherited models.