code: def setupQuery(self, query, op, editor):
          
          if editor is not None:
              value = editor.currentRecord()
              if value is None:
                  return False
          
          return super(ForeignKeyPlugin, self).setupQuery(query, op, editor)
docs: Sets up the query for this editor.