Fixed #23721 -- check_related_objects without calling __iter__

https://code.djangoproject.com/ticket/23721