class_docstr: A filter to allow searching for related owners of a resource.
  
  Use in the api by adding something like:
  related_field_filters = {
    "owners": RelatedFieldFilter("first_name", FilterRelatedOwners),
  }
class_docstr_tok: ["A","filter","to","allow","searching","for","related","owners","of","a","resource",".","Use","in","the","api","by","adding","something","like",":","related_field_filters","=","{","``","owners","''",":","RelatedFieldFilter","(","``","first_name","''",",","FilterRelatedOwners",")",",","}"]
code: def apply(self, query: Query, value: Optional[Any]) -> Query:
      user_model = security_manager.user_model
      like_value = "%" + cast(str, value) + "%"
      return query.filter(
          or_(
              # could be made to handle spaces between names more gracefully
              (
                  user_model.first_name + " " + user_model.last_name
              ).ilike(like_value),
              user_model.username.ilike(like_value),
          )
      )
  
file_path: superset/superset/views/filters.py
imports: import logging
  from typing import Any, cast, Optional
  from flask import current_app
  from flask_appbuilder.models.filters import BaseFilter
  from flask_babel import lazy_gettext
  from sqlalchemy import and_, or_
  from sqlalchemy.orm import Query
  from superset import security_manager
label_desc: Use image node_id 1 for calling the FilterRelatedOwners obj's underlying member method code with example usage: obj.apply(query, value) and returns: query