1👍
Heads up, this should work as of Django 1.9.
Entry.objects.filter(pub_date__date=datetime.date(2005, 1, 1))
Entry.objects.filter(pub_date__date__gt=datetime.date(2005, 1, 1))
0👍
Use __contains instead of __date:
r = Record.objects.filter(time__contains = datetime.today().date())
UPDATE
Since that __startswith (LIKE ‘value%’) is more faster than __contains (LIKE ‘%value%’), the best choice is:
r = Record.objects.filter(time__startswith = datetime.today().date())
- [Answer]-Cannot sync database for Django app on its Heroku postgres database
- [Answer]-Redirect django URL to particular app
- [Answer]-Update only from's visible fields if parent model doesn't exist
- [Answer]-Django passing parameter as a string
- [Answer]-Django Sorting a List inside a model
Source:stackexchange.com