Franz Noel Franz Noel - 2 months ago 15
Python Question

Filter by exact date after receiving webapp2 request on Python GAE

After receiving the the date by

q = self.request.get('q')
, I am trying to filter by complete date, but it gives me blank results. My query is as follows:

custQuery = db.Query(Customer)
birthdate = datetime.strptime(q,"%Y-%m-%d")
custQuery.filter('birthdate >= ',birthdate)
custQuery.filter('birthdate < ',birthdate)


But, I get blank results although I know that the q(which is the certain date) is existing and I have an existing
birthdate
property. What is the proper way to filter requests by exact date on Google App Engine?

Answer

Silly me. It should be equal sign.

custQuery = db.Query(Customer)
birthdate = datetime.strptime(q,"%Y-%m-%d").date()
custQuery.filter('birthdate = ',birthdate)