Fixed #23616 - lookup_allowed AttributError fix

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

	Thanks timgraham for review