I've been trying to compare dates in a query given to SQLALchemy as follows:
start = time.strptime(start, "%d%m%y")
end = time.strptime(end, "%d%m%y")
list_ideas = Idea.query.filter(time >= start, time <= end).all()
However, this does not return results regardless of dates given (where Idea.time = db.Column(db.DateTime, default=db.func.now())). I've searched through some other answers regarding this topic and from what I have gathered, I am not making the same mistakes.
In addition, changing the query to Idea.query.filter(time >= start, time <= end, deleted=False).all() gives the error:
TypeError: filter() got an unexpected keyword argument 'deleted'
Any pointers would be appreciated.
--
EDIT: I noticed that I was using import time, which may have caused the error. However, after changing it to from time import strptime, I now experience the error:
NameError: global name 'time' is not defined
Idea.query.filter(Idea.time >= start, Idea.time <= end).all()from datetime import datetimeanddatetime.strptime(start, "%d%m%y")for start and end (and also the above).