Fixed #23616 - lookup_allowed AttributError fix

If field.rel has no get_related_field(), rel_name is set to None

Thanks ranjur for reporting bug, timgraham for review,
and collinanderson for contributing tips