title: Flask restless - A search filter for a relationship.property != val in case of one-to-many relationship
body: <p>Flask-sqlalchemy Models for my <strong>book</strong> and <strong>actions</strong> tables are</p>
  
  <pre><code>class Book(db.Model):
  
      __tablename__ = 'book'
  
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(255))
      activity = db.relationship('Actions')
  
  class Actions(db.Model):
  
      __tablename__ = 'actions'
  
      id = db.Column(db.Integer, primary_key=True)
      book_id = db.Column(db.Integer, db.ForeignKey('book.id'), nullable=False)
      action = db.Column(db.Enum(['requested', 'issued', 'opened', 'closed']), nullable=True)
      created_on = db.Column(db.DateTime, default=_get_date_time)
  </code></pre>
  
  <p>Basically it's a one-to-many relationship between a book and actions. And I am using <a href="https://flask-restless.readthedocs.org/en/latest/" rel="nofollow">flask-restless</a> for the API. </p>
  
  <p>I need to get </p>
  
  <blockquote>
    <p>All books that have not been closed</p>
  </blockquote>
  
  <p>I have tried below <a href="https://flask-restless.readthedocs.org/en/0.7.0/searchformat.html" rel="nofollow">search queries</a></p>
  
  <pre><code>q={
  "filters": [
      {
        "name": "activity",
        "op": "any",
        "val": {
          "name": "action",
          "op": "not_equal_to",
          "val": "closed"
        }
      }
    ]
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>q={
    "filters": [
      {
        "name": "activity",
        "op": "any",
        "val": {
          "name": "action",
          "op": "not_in",
          "val": ["closed"]
        }
      }
    ]
  }
  </code></pre>
  
  <p>But I am getting wrong result</p>
  
  <pre><code>{
  "num_results": 30,
  "objects": [
  {
    "activity": [
      {
        "action": "opened",
        "created_on": "2015-06-05T17:05:07",
        "id": 31
      },
      {
        "action": "closed",
        "created_on": "2015-06-05T17:05:44",
        "id": 32
      }
    ],
    "id": 1,
    "name": "K&amp;R"
    ....
  },
  ...
  ]
  "page": 1,
  "total_pages": 3
  }
  </code></pre>
  
  <p>Am I making some mistake here or this kind of thing is not possible in restless? </p>
  
  <p>Please help me out.</p>