stinaq
stinaq

Reputation: 1284

Python flask restless search query to find date regardless of time

I'm using Flask and Flask-Restless and have a model that looks like this:

class Task(db.Model):
    __tablename__ = 'Task'
    id = db.Column(db.Integer, primary_key=True)
    stable_id = db.Column(db.Integer, ForeignKey('Stable.id'))
    taskDate = db.Column(db.DateTime())
    stableuser_id = db.Column(db.Integer, ForeignKey('StableUser.id'))
    rating = db.Column(db.Integer())
    shift = db.Column(db.Text())
    db.UniqueConstraint('Task.taskDate', 'Task.shift')
    stable = relationship("Stable")

I want to find all tasks with a specific date, but I don't care about the time. When I query using this filter:

Task?q={"filters":[{"name":"taskDate","op":"eq","val":"2015-11-08T21:41:43"}]}

I get all tasks registered with that exact time and date. But when I filter like this:

Task?q={"filters":[{"name":"taskDate","op":"eq","val":"2015-11-08"}]}

I get no results at all. Is there a way to filter for date regardless of time?

Upvotes: 2

Views: 200

Answers (0)

Related Questions