Better check for parent_model in get_model_from_relation