docs: def get_model_from_path_string(root_model, path):
      """ Return a model class for a related model
      root_model is the class of the initial model
      path is like foo__bar where bar is related to foo
      """
      for path_section in path.split('__'):
          if path_section:
              try:
                  field, model, direct, m2m = _get_field_by_name(root_model, path_section)
              except FieldDoesNotExist:
                  return root_model
              if direct:
                  if _get_remote_field(field):
                      try:
                          root_model = _get_remote_field(field).parent_model()
                      except AttributeError:
                          root_model = _get_remote_field(field).model
              else:
                  if hasattr(field, 'related_model'):
                      root_model = field.related_model
                  else:
                      root_model = field.model
      return root_model