nah_ny
nah_ny

Reputation: 47

Django - Filter not returning objects in database

Attempting to filter a MYSQL database to return a set of objects created on a given day:

len(Model.objects.filter(x__year=year, x__month=month, x__day=day)

Checked the database and there are objects there. The previous line of code still returns no objects ~0.

What is causing this?

Upvotes: 0

Views: 123

Answers (1)

DS.
DS.

Reputation: 24110

Maybe just that you have a single underscore in x_month -- should be x__month.

Upvotes: 3

Related Questions